Setup Headless Dropbox Sync Client on Linux

Setup Headless Dropbox Sync Client on Linux

Category : How-to

Get Social!

dropbox-logoDropbox is a cloud based file storage service which makes your files available from almost any internet connected device. You simply synchronize a folder with the service on each device and Dropbox keeps them in sync, automatically updating each folder as files are added and removed on each machine.

You can register for a free account which gives you a limited amount of storage to use – no strings attached. To register, visit Dropbox (Please note, that is my affiliate link which gives me a bonus if you sign up. If you’re not happy with this, you can simply visit and sign up. I’d be most grateful if you’d use the link :) ).

Dropbox offers a client to use on Windows, Mac OSX, Linux, iPhone and Android which you can download for free. These are all graphical interfaces and do not work for deployment on a headless server.

Thankfully, the Dropbox team have created an easily deployable Dropbox client which works without a desktop installed and can be managed by a Python script. To get started, download the Python script to your home directory on your headless server with wget.

Give the script the permission to execute.

You can now use the Python script to download the Dropbox client. The client will be downloaded to your users home directory so make sure that you are logged in with the correct user.

The client binaries will now be downloaded and installed. The next step is to register your account with the Dropbox client so that synchronization can begin. Start Dropbox for the first time with the Python script and you will be presented with a link. Paste the link into a web browser and login to your Dropbox account to grant access to the client. As soon as this process completes, your Dropbox client will begin synchronization.

Once you have got all this working and the Dropbox client is synchronizing your first files, it’s time to add an init.d script so that the Dropbox client starts with your operating system. Things may differ here, depending on your Linux distribution. Add one of the below scripts to your init.d folder and substitute [USER] for the list of users who will use the client.

Ubuntu/ Debian

Then add the execute permission and add it to the startup routine.

RedHat/ Fedora/ CentOS

Change permissions and add to the startup routine.

Related posts:



2-Oct-2014 at 9:23 am

Thanks, very useful script.

Chris R. Chamberlain

15-Oct-2014 at 9:52 am

Best tutorial found – one gotcha on current 32bit Ubuntu 14.04 LTS install is line 5 in Ubuntu/Debian /etc/init.d/dropbox.

The file ‘.dropbox-dist/dropbox’ needs to be ‘.dropbox-dist/dropboxd’


    15-Oct-2014 at 12:12 pm

    Thanks, Chris. I have updated line 5 in the script as the filename may have changed since I installed it myself.

Henry Armitage

9-Nov-2014 at 4:38 pm

Hey, I just thought I’d let you know that I tried a few of the init.d scripts out there to start Dropbox and this was the only one that actually worked with the version posted on at the time (ver 1.6.2 as of 9 Nov 2014). Thanks for posting this!

Martin Dell

25-Feb-2015 at 10:08 am

Awesome thank you. Exactly what I was looking for and worked first time – even though I’m no Linux expert

Jason Penney

11-Jun-2015 at 1:01 pm

Thanks, this works great.

I added the following to ‘status()’, just after the if/else, to get more details:

Output looks like this:


13-Jun-2015 at 3:04 pm

Thanks for this!

I’m wondering if it’s possible to have the dropbox folder placed somewhere other than it’s default using this method?

I’m fairly new to linux so I apologize if this has an obvious answer.


Simon Lee

23-Nov-2015 at 6:10 am

Question: I am using this script on Ubuntu Desktop 14.04.04 and , find that stop() doesn’t work well on Nov-2015.

As you know, start() uses “.dropbox-dist/dropboxd” , and this is symbolic link to “.dropbox-dist/dropbox-lnx.x86_64_3.10.11/dropbox” (no ‘d’ in last)
This symbolic link works well when start() is called. But in stop(), this link doesn’t work well. I am not sure that this might be caused from Ubuntu version.

I slightly changed stop() part like below, to avoid the issue.
“start-stop-daemon -o -c $dbuser -K -u $dbuser -n dropbox”

If anyone know better way, please share it.


    12-Feb-2016 at 12:18 pm

    @Simon Lee, works great, thanks!

    Dainius Žiūra

    22-Jun-2016 at 1:31 pm

    This works on Ubuntu Server 14.04
    stop() {
    echo “Stopping dropbox…”
    for dbuser in $DROPBOX_USERS; do
    dbpid=`pgrep -u $dbuser dropbox`
    HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
    FULLPATH=`ls -l /proc/$dbpid/exe | rev| cut -d’ ‘ -f 1 | rev`
    if [ -x $HOMEDIR/$DAEMON ]; then
    start-stop-daemon -o -c $dbuser -K -u $dbuser -x $FULLPATH

Monte Price

10-May-2016 at 7:25 pm

solved my problem. thanks


4-Jul-2016 at 3:20 pm

I was trying this out, not on a server, but rather on a separate user on my laptop which I’ve su’d into (just trying to keep proprietary stuff in its own corner as much as I can). It gives a GTK error and even a segfault. Turns out that su still sets the `DISPLAY` environmental variable to something, so you want to unset it:

export DISPLAY=

After this, that problem went away.


4-Jul-2016 at 4:08 pm

Another strange bit, perhaps related to my environment. I never get the prompt telling me to visit the website. Instead it just looks like dropbox starts. However when I directly run:


I do get that prompt.

Leave a Reply

Visit our advertisers


Quick Poll

Do you use GlusterFS in your workplace?

Visit our advertisers