Simplify your server using Dropbox, Selective Sync

Everyone loves Dropbox for the simple and instant syncing of files between their devices but as anyone who runs their own website or blog knows it can often be a pain to get files to and from your servers... Dropbox is made to solve this problem, it just takes a little coaxing.

In this tutorial we are going to bring the simplicity of Dropbox to your server by selectively syncing your files, make those files accessible anywhere and your life easier.


This tutorial assumes you are using Ubuntu on your server it may work on other distributions with small tweaks. I run simple servers on Amazon EC2 and Linode, if you are just getting started start there.

I'm going to go a little fast with the steps here, my main goal is to get all this information together so the next person doesn't need to search half of the internet to find it like I did.

Step 1: Go into your local Dropbox folder and create a folder called Server, or whatever you'd like but if it's different you'll need to remember that later.

Install Dropbox

Step 2: Next, get a command line session with your server via SSH. Then let's check if you are on 32 or 64 bit.

uname -m

If it says x86_64:

cd ~ && wget -O - "\
?plat=lnx.x86_64" | tar xzf -

If it says i686:

cd ~ && wget -O - "\
?plat=lnx.x86" | tar xzf -

Step 3: Let's download a nice python script to help us manage Dropbox. And a bash script that we'll use to start and stop Dropbox.

mkdir ~/utils
wget -O ~/utils/ "\
chmod 755 ~/utils/
wget -O ~/utils/dropbox_temp "\

Step 4: Run the Dropbox daemon from the newly created .dropbox-dist folder.


Step 5: Dropboxd will tell you "This client is not linked to any account..." and give you a link copy that and paste it in your local web browser, authenticate and validate the new connection.

Step 6: Once Dropbox is connected kill the daemon with a Ctrl-C.

Now that Dropbox is linked let's install it as a service in Ubuntu.

Step 7: First, edit the script and replace "user1 user2" with your server username not your Dropbox account. Then we'll move it to the right place, set the proper permissions and have it start on boot.

nano ~/utils/dropbox_temp
sudo mv ~/utils/dropbox_temp /etc/init.d/dropbox
sudo chmod +x /etc/init.d/dropbox
sudo update-rc.d dropbox defaults

Check if Dropbox is running, if it's not start it.

sudo service dropbox status
sudo service dropbox start

It's Alive

~/utils/ status
-> Downloading 3,134 files (0.1 KB/sec, a long time left.
Grab a Snickers)

Ahhh! Basically right now Dropbox is syncing your entire Dropbox to your server, for me that's not good so let's pare it down using selective syncing.

Selective Sync

Step 8: You will need to call the 'exclude add' command for each top level folder you don't want to sync, I'd suggest starting by excluding your biggest folder to save Dropbox and your server some work.

cd ~/Dropbox
~/utils/ ls
-> Photos Projects Public Server Work
~/utils/ exclude add Projects
~/utils/ exclude add Photos
~/utils/ exclude add Public
~/utils/ exclude add Work
~/utils/ ls
-> Server


Go to the Dropbox folder in your server home directory, create a file in it and let's test it out.

cd ~/Dropbox/Server
echo 'success' > success.txt

Check your Dropbox folder on your local machine, if success.txt just showed up you are connected!


The folder works both ways, make edits, add a new file and you'll see it on your server nearly instantly.


blog comments powered by Disqus

recent stream

  • @benhedrington
    RT @bud_caddell: How GE Implemented FastWorks to Act More Like a Startup
  • @benhedrington
    RT @withfries2: Jeff Dean says TensorFlow just passed Linux to become #15 most starred Github repo: 12k+ commits, 500+ contributors #aifron…
  • @benhedrington
    RT @jasonfried: Announcing our next book: The Calm Company. A direct attack on “it’s crazy at work” —>
  • @benhedrington
    RT @paulg: When deciding what to do, the best choice is often one that's simple but hard.
  • @benhedrington
    RT @BenedictEvans: So far, ecommerce is for things you already want. Hence, little impact on overall ad spending. But if it could suggest o…