Access Dropbox From Linux Server Command Line
Access Dropbox from the command line on a Linux server is a real time saver, especially for developers. Sharing files between Virtual Machines (VM) can be a pain, especially if your VM is running on a text based server without UI. For example, I start up a new VM for almost anything and I deal with up to 20 different sites and application and every one has it’s own VM.
VMWare provides it’s “Guest Additions” and that includes folder sharing. It works fine on desktop os, but on the command line we have to mount it using VMWare file system, which can be a bit cumbersome. A much simpler and easier way to share files is via USB or Dropbox. Getting the Dropbox sync daemon to run is really easy and once running, anything you add to Dropbox will be synced to your VM transparently and at network speed.
If you don’t already have a Dropbox account setup, get a free one here. Now on to the steps to get to use Dropbox from the command line and get the Dropbox sync daemon up and running.
SSH to your Linux server and change to your home directory.
For 32 bit os
wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86"
For 64 bit os
wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86_64"
After the file “dropbox.tar.gz” downloaded properly, then extract it
tar -xvzf dropbox.tar.gz
The following error message is expected: This client is not linked to any account…
Please visit https://www.dropbox.com/cli_link?host_id=123456789qwertyuiop to link this machine.
Copy / paste this url (the one in your browser, not the above) into the browser of your desktop machine and log in. This is the process of where your VM will be authorized and added to the account. Once completed, the daemon dropboxd should have created a ~/Dropbox folder and synchronize your files.
If you want to change the account it is linked to, unlink it from the first account, then kill the running dropbox process, start it up again (with “~/.dropbox-dist/dropboxd &”) and obtain the new host_id with dbreadconfig.py . If you don’t restart the dropbox client, it will give the same host_id (which for some reason cause me to be unable to change the account it is linked to).