Syncing files via Dropbox to a linux server

Posted on Aug 17, 2020

I have a penchant for keeping all my notes and todo lists in plain text, and these files are synced between by phone and laptops with Dropbox.

I also wanted the capability to quickly run scripts against them. The iPhone app Shortcuts allows you to run arbitrary code via ssh which was a perfect solution for me, so I needed my todo files somewhere that I could ssh into. For me, this was an linux server I keep running. These are the steps to setup Dropbox syncing a particular folder to your linux server.

First you need to install some extra dependencies 1 which are required by the Dropbox install script.

1
sudo apt-get install libc6 libxxf86vm1 libglapi-mesa libxdamage1 libxfixes3 libxcb-glx0 libxcb-dri2-0 libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxshmfence1

We can then grab the correct version of the install script from https://www.dropbox.com/install-linux

I am running Ubuntu 18.04 x64 so the install commands look like so.

1
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf

That will download the install script and run it. We can then start running the Dropbox daemon. The first time we run this, it will prompt us to authorise ourselves by following a link in the browser. After doing so, it may appear to hang, but the daemon is just running in the foreground. You can ctrl-c to get out of it.

1
~/.dropbox-dist/dropboxd

We then want to download the python script which Dropbox provides to control the service. The following will download it to your home directory.

1
cd ~ && wget -O ./dropbox.py https://www.dropbox.com/download?dl=packages/dropbox.py

We can then use the script to setup the Dropbox service to autostart.

1
./dropbox.py autostart

And then actually start it in the background.

1
./dropbox.py start

If you are like me, you probably don’t want your entire Dropbox folder syncing to your server, so you can do the following. This will exclude the content of the Dropbox folder from syncing, and then specifically allow a certain folder. In this case some_folder_you_specifically_want_to_sync.

1
2
./dropbox.py exclude add ~/Dropbox
./dropbox.py exclude remove ~/Dropbox/some_folder_you_specifically_want_to_sync

Et voila! You now have a specific folder syncing to your Linux server with Dropbox!


  1. This was discovered after hitting upon a bug detailed here: https://www.dropboxforum.com/t5/Dropbox-installs-integrations/Headless-install-on-Debian-libglapi-so-0-cannot-open-shared/td-p/396457 ↩︎