- Router flashed with OpenWRT firmware. I'm using TP-Link TL-Wr103ND V2 & flashed with OpenWRT Barrier Breaker 14.07
- A Dropbox account
Dropbox App Key & App Secret
The first step is to sign in to Dropbox app creation page to get a Dropbox App key & App Secret from Dropbox. The App key & App Secret will used by Dropbox API for authorizing access to resources on Dropbox.
- Sign in to Dropbox app
- Create a new Dropbox Platform app
- Select a Dropbox package
- Email verification
- Select type of app
- Record down the Permission type, App key and App secret
Installing Dropbox Uploader
Next step is to SSH to router and download Dropbox Uploader from github to the router /root directory. Command line below supposed to do the job, unfortunately it is not working.
It download the Dropbox Uploader file (dropbox_uploader.sh) with zero file size as shown in figure below
To overcome this problem, I have to download the Dropbox Uploader (dropbox_uploader.sh) to my computer and then transfer it to router. I'm using WinSCP to transfer Dropbox Uploader to the router as shown in figure below.
The correct procedures to installing the Dropbox Uploader would be:
- Download the Dropbox Uploader (dropbox_uploader.sh) to computer
- Transfer the dropbox_uploader.sh file to router /root directory using WinSCP.
- SSH to router & execute the following command
opkg install bash curl coreutils-stat
chmod 755 dropbox_uploader.sh #give the execution permission
Authorizing access to resources on Dropbox
SSH to router and run the Dropbox Uploader
-k means doesn't check for SSL certificates (insecure)
Enter the App key and App secret accordingly, enter "a" (lower case) will set Folder Permission type to App Folder. Finally enter "y" to continue.
If everything is OK, it will generated a URL for you to access your Dropbox folder, otherwise it will prompted "bad App key" until you had enter a correct App key & App secret.
Leave the above windows open and then open your web browser, enter the generated URL (https://www.dropbox.com/1/oauth/authorize?oauth_token=??????????) as shown in figure above, this will prompted you to access folder inside your Dropbox.
After clicking on the Allow button, you are allowed the Dropbox Uploader access to your Dropbox folder, come back to the SSH window and press the Enter key. Your Dropbox Uploader is setup completed as shown in figure below:
Upload file to Dropbox
Example below will upload the test.txt file in /tmp directory to the Dropbox app root folder. Please read here for more usages.
|./dropbox_uploader.sh -k upload /tmp/test.txt /|
|/root/dropbox_uploader.sh -k upload /tmp/test.txt /|
Download file from Dropbox
Example below will download test.txt from Dropbox to router /tmp folder
|/root/dropbox_uploader.sh -k download /test.txt /tmp/|
Delete a file from Dropbox
Example below will delete a file from Dropbox
|/root/dropbox_uploader.sh -k delete /text.txt|