Why use Dropbox on your Headless Linux Server?
Everyday I work with Windows, OS X, and Linux. Because of this I need a good way to access the same files on all three systems. To do this I have been using Dropbox for a while now and I have been really impressed with how well it works. It is so much more reliably than say OneDrive.
Most importantly though, Dropbox has clients available for Windows, OS X, and Linux and apps for iPhone and iPad!
I have always found it a pain though quickly getting files to my Ubuntu Web Servers though. Recently, I had the thought that maybe I could get Dropbox running on my Web Server and make it just a bit easier to get files to and from it. I did some research and after reading through quite a few seperate articles finally got Dropbox up and running on server.
Here are the steps I used to get it working:
The first thing you need to do is go to the Dropbox website and follow the instructions to download the Dropbox headless install: https://www.dropbox.com/install?os=lnx
Once you get Dropbox installed and try to run it for the first time, you will need to follow some instructions to authorize the daemon to use your Dropbox account. Now the key here is that you have to authorize the daemon by accessing the Dropbox website and logging in to your account from the computer (IP) that you are trying to authorize.
Supposedly, you can use the console text based browser Lynx to do this but I couldn't get this to work because of some issues not being able to click on and access the Sign In buttons on the Dropbox.com. Instead I used an SSH tunnel to authorize access using Chrome on my latop. Do a google search for how to do this with Chrome and you should find some good articles.
Now you want to be careful after authorzing and running the Dropbox daemon for the first time. The process will immeadiately start trying to sync all of your Dropbox data but luckily it won't be doing this in the "background" so if you just
c and stop the script it should stop downloading and will not fill up your entire VPS.
Now with a bit of help from Python
Now you need to download the Python script for working with the Dropbox CLI that makes your life so much easier! And in case you're wondering, yes this script does make it possible to exclude the syncing of certain folders.
If you need more info than I put below, follow the instructions in this great article: http://www.dropboxwiki.com/tips-and-tricks/using-the-official-dropbox-command-line-interface-cli
You should make a
bin folder just like they suggest in the article in your home folder and then download the Python script to that folder.
Test that the script is working with the following command:
You should get a response back that Dropbox is not running.
So, time to start it up and then to quickly exclude your largest folders, if necessary:
To make sure Dropbox starts automatically:
~/bin/dropbox.py autostart y
To list the excluded folders:
~/bin/dropbox.py list exclude
To exclude a folder:
~/bin/dropbox.py exclude add ~/Dropbox/reallyLargeImagesFolder/
Once you go through and exclude all the folders you don't want on your VPS, then you should be good to go!
If you want to sync any folders that are not contained within your
home/Dropbox/ directory, then you can use a symbolic linc to do so. Check out this stack exchange post to find out more: http://askubuntu.com/questions/400379/how-to-sync-my-dropbox-files-with-a-preferred-local-folder
That's it! Happy Dropboxing!