I thought I'd share something useful: Dropbox has a headless Linux client. It's entirely self-contained. You can use a standard Ubuntu image without any package dependencies. You can even make a temporary user to install and test it without using root.
You can use such a Dropbox setup to sync all or part of a Dropbox account on a Droplet. I wouldn't use it for production, but this is promising as a quick and easy prototyping and development tool. It's also handy if you want to link up temporarily and get rid of some clutter if you have a big image sharing folder or the like. You can then view and organize using your standard Desktop tools, and unlink afterward.
It also means you can use any of a myriad of iOS and Android programmers' text editors with Dropbox integration built in. These let you update the site in real time. If your connection drops, you don't get booted as with a shell. Instead, it will merely sync when you reenter a coverage area.
What you need:
1. A Dropbox account. Use what you already have, or use my referral for a free account with an extra 500 megs: http://db.tt/TnWRgX1 (If you find it useful enough to stick around, I think I eventually get a little space too :)
2. The Linux client. Connect to a droplet and use one of these commands:
32-bit Linux: cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf - && ~/.dropbox-dist/dropboxd
64-bit Linux: cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf - && ~/.dropbox-dist/dropboxd
Note that you can do this with a regular user account. Root is neither required nor encouraged.
The above launches a temporary instance of the dropbox daemon. That's sufficient for full use, but requires you to keep a terminal open (or at least a screen session). Look at dropboxd for more options if you want to launch this from an init script. Otherwise, with this approach you can kill it with ^C at any time.
You can also find .debs and .rpms for more permanent installations at:
https://www.dropbox.com/install?os=lnx
The client will now give you a link to visit in your browser. If you follow that link, you'll be prompted for a password on the Dropbox site. This issues a token for Dropbox use so you don't have to store your Dropbox password on the Linux instance.
At this point, Dropbox is mirroring the contents of a new ~/Dropbox folder. Any files you drop into this folder from any other client will appear on your Linux machine instantly. They use filesystem change notifications to catch changes as they happen. This means there is no manual sync step, and no waiting for the client to notice changes.
You probably don't want to host content out of your Dropbox folder, but there's a basic trick for mirroring Dropbox content outside of the Dropbox folder: create a symbolic link.
Example: ln -s /var/www/foo.com ~/Dropbox/foo.com
This will cause Dropbox to treat /var/www/foo.com as if it resided inside the Dropbox folder. All other clients will see foo.com as a folder within the Dropbox folder, and will transparently sync across that symlink.
If you don't have the Dropbox client on your desktop, you can get that at:
https://www.dropbox.com/downloading
And mobile clients: https://www.dropbox.com/mobile
For mobile text editors, etc with Dropbox built in, just search the Apple App Store, Google Play, etc. There are hundreds of Dropbox-enabled apps.
Caveats: All files will be created as the user Dropbox is run as, and will use default file and directory permissions. Check your default masks if you have a special use case.
Cleaning up: If you've had a test run with Dropbox on your Droplet but you want to eliminate it, do this:
1. ^C to stop the dropbox program
2. Kill all Dropbox files: rm -Rf ~/.dropbox* ~/Dropbox
3. Revoke the token that was issued for your test session by clicking "unlink" next to your Droplet's host name: https://www.dropbox.com/account#security
At any point in the future, you can repeat the install step in order to sync up to the current state of your Dropbox account and do further development, experimentation or decluttering.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart.
If you run into issues leave a comment, or add your own answer to help others.
×
Thanks for the writeup Brian.
I am trying to serve a jekyll blog (static HTML) using Dropbox and nginx - is it necessary to hold HTML files in the Public folder in order to properly view them? I’ve tried to symlink between my nginx public html and dropbox html content but get 404s back.
Thanks for any help ~Jonathan
@hungai Symlinks should be fine. One thing to look out for are permissions errors. You’ll need to make sure the files are accessible by the
www-data
user.I have 1TB on my dropbox and only 30GB on my droplet. Is there a way to sync only certain dropbox folders?
@beornmorder this might help you out