Ubuntu Server Install also contains some notes on getting Dropbox running via the command line.


  • At least version 2.4 of the C library
  • wget
  • Python 2.x ≥ 2.5 (we do not offer support for Python 3.0)
  • a web browser

Setup process

Short version

  1. Get the latest release tar from the download page: x86  |  x86_64  |  Forum Testing Build
  2. Files are extracted to .dropbox-dist
  3. Run dropboxd


I’ve prepared a repackaged version of dropboxd and dropbox\_cli which can be installed once per host (or per system) and which have built-in support for multiple DropBox directories per user. I’ve added in a «link» command to «dropbox\_cli» that gives you 2 minutes to link your DB account to the specified directory. This is taken from the v1.1.6 release. You can find it here:

Step-by-step version

  1. Log in to your Linux server so you obtain a shell prompt, and change to your home directory.


  2. Stable 32-bit:

    wget -O dropbox.tar.gz «http://www.dropbox.com/download/?plat=lnx.x86»

Stable 64-bit:

wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86_64"
  1. Sanity check to make sure we’re not going to clog our home directory.

    tar -tzf dropbox.tar.gz

  2. Extract

    tar -xvzf dropbox.tar.gz

  3. Make sure the LANG environment variable is set to something other than NULL, e.g. en_US.iso88591. If it is NULL, you’ll get a cryptic error.

  4. Run dropboxd


  5. You should see output like this:

    This client is not linked to any account… Please visit https://www.dropbox.com/cli_link?host_id=7d44a557aa58f285f2da0x67334d02c1 to link this machine.

dropboxd will create a ~/Dropbox folder and start synchronizing it after this step! Go to the URL given; you should see a success message at the top of your screen.

NOTE: If you want to change the account it is linked to, unlink it from the first account, then kill the running dropbox process, start it up again (with «~/.dropbox-dist/dropboxd &») and obtain the new host\_id with dbreadconfig.py . If you don’t restart the dropbox client, it will give the same host\_id (which for some reason cause me to be unable to change the account it is linked to).

NOTE: Windowless Installs

If you are unable to get a normal browser running on this machine (if its a server for example) then there are three possible solutions:

Use a command-line browser (lynx)
  • Install ‘ lynx‘ (if you need to)
  • Get to the client not linked stage of the process above
  • Leave that process running..
  • … and open a new terminal or screen.
  • Navigate to the dropbox website in lynx.  lynx
  • Log in to your dropbox account
  • Now navigate to the link you were provided. To do this; make sure you’re not focused in a text-box (using cursor keys) and press g. You can now paste your client link url and hit enter.
  • On this page you will be asked to re-confirm your password… it’s quite a long way down the page.
  • Switch back to your other terminal/screen where the linking process is still running and after a second or two it should link!
  • Continue these instructions below to start dropbox
Type the link on a computer which has a browser

If you do not have or cannot install a browser on the computer on which you wish to install Dropbox, this is the easy workaround which needs no knowledge of networks.

  • Get to the client not linked stage of the process above
  • Log into your dropbox account in a browser window on another system.
  • Type the URL given in the client not linked stage into the browser
  • Enter your dropbox password when prompted
  • You should then receive a message to confirm the client has been linked.
  • Switch back to your other computer where the linking process is still running and after a second or two it should link!
  • Continue these instructions below to start dropbox
Use an SSH tunnel from a computer which has a browser

You can also create a SOCKS tunnel through SSH from another computer that has a browser and link the client through that.

From computer with browser: 

ssh -D 9999 username@ip-address-of-computer-to-install-dropbox-on 

Now enable SOCKS proxy in Firefox (or your browser of choice) with host as ‘localhost’ and port as ‘9999’ and navigate to the link echoed by dropboxd. Log in to authenticate your client and you’re done! Use Google for more help on using SSH as a SOCKS proxy.

dropboxd didn’t give me a link URL!

Run the dbreadconfig.py script to get the URL with the hostid. It’s documented here.

Notes on Custom Python Scripts


I have created a (hopefully) ‘better’ version of \dbreadconfig.py\ here. You can then replace the call to dbreadconfig.py above with pyDropboxValues.py _linkurl. I won’t update the instructions above though till I get feedback that my version works correctly. — AndrewS1 2010-10-15 01:41:03

  • dbreadconfig.py fails on my machine (gutsy) when importing ctypes. Try deleting all the code which uses ctypes, since you only need that for Windows anyway. — TrevorB 2009-03-18 01:52:58

  • dbreadconfig.py failed on my Ubuntu 8.04 – I just had to apt-get install gcc and libc6-dev. — Mario

  • Also, separately, please put each import statement on a different line so that debugging can go much faster, among other reasons (PEP 8). — jperla

  • If dropboxd just exits without any reason, check that you allow enough size for data seg, stack, virtual memory (ulimit -a). — tomle

  • Sometimes you need to use python2.6 instead of just python

    python2.6 ~/bin/dropbox.py help

  • dropbox can also be set up on a shared hosting account, the only difference with this here Dropbox With Daemontools is that rather than creating a new user one has to follow the instruction with the same user available for the hosting account. – luisc


Following on from that, there are a few different options to run the Dropbox client on an ongoing basis. You could put the above line in your server startup scripts, e.g. /etc/rc.local, or maybe just a certain user’s login scripts.

It is recommended to download the official Dropbox CLI to start the dropbox daemon (as an unprivileged user) and get its status.

$ mkdir -p ~/bin  
$ wget -O ~/bin/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"  
$ chmod 755 ~/bin/dropbox.py  
$ ~/bin/dropbox.py help    

In case you get the following error (after trying to run the Dropbox CLI):

$ ~/bin/dropbox.py help  File "/home/username/bin/dropbox.py", line 91  with open(pidfile, "r") as f:  ^ SyntaxError: invalid syntax    

update to Python 2.6 and it will go away. Or better try python2.6 rather than your plain command python as you may already have it installed.

NOTE: For CentOS users, use either the EPEL or IUS repo to install the python26. RPM. The package installs Python 2.6 in parallel to the distribution default version. This way YUM will not be effected by the newer version. Once installed update the hash-bang line to refer to /usr/bin/python26 or /usr/bin/python2.6.

Changing the dropbox folder location

To move an existing dropbox folder to /foo/bar:

$ dropbox stop $ cp ~/.dropbox/dropbox.db dropbox.db.backup $ wget http://dl.dropbox.com/u/119154/permalink/dropboxdir.py $ chmod %2Bx dropboxdir.py $ mv ~/Dropbox /foo/bar $ ./dropboxdir --setfolder=/foo/bar $ dropbox start 

(Do not just create a new empty directory and setfolder to it – when you restart dropbox, it will think you’ve deleted all your files, and delete them from everywhere else too.)

(The script dropboxdir.py must be located in parent directory to ~/.dropbox-dist/ )

Note that the script above currently only works for Dropbox 0.7.x and not 1.0.x – for Dropbox 1.0 you can use this PHP script or this Python script.

Using symbolic links to move the folder location

$ dropbox stop $ mv ~/Dropbox /target/folder $ ln -s /target/folder/Dropbox ~/ $ dropbox start 

Suppress LAN Sync broadcasts

To stop dropbox from sending LAN Sync broadcasts every 30 seconds over port 17500 () see DisableLanSync

Unlink / Relink dropbox account

You shouldn’t need to do this, but occasionally it can fix «odd quirks», so is often recommended as a troubleshooting tip on the forums.

To unlink:

$ dropbox stop $ mv ~/.dropbox ~/.dropbox.old 

To relink:

$ dropbox start 

Running on system startup

Some *nix boxes will let you use «cron» to ensure that dropbox starts up when the machine boots. I’ve done this by putting

@reboot $HOME/.dropbox-dist/dropboxd 

into my crontab. Do «man 5 crontab» in a console window to see if your flavor of cron supports that syntax.

You can also use an init.d or event.d script to automatically run dropboxd.

/etc/init.d/dropbox and service dropbox can be called with start, stop, restart and status.

Check below for further instructions once you have downloaded the \init.d\ script for your platform.


Click here for a sample init.d script for Debian/Ubuntu and the event.d sample.

$ chmod %2Bx /etc/init.d/dropbox $ update-rc.d dropbox defaults 
using upstart

If you want to use the newer upstart init present on Ubuntu installations and are running dropboxd under a sandbox user (say, dropbox), you can place the following script into /etc/event.d, naming it dropbox

start on runlevel 2 start on runlevel 3 start on runlevel 4 start on runlevel 5 stop on shutdown respawn script 
# Without next line DB does not sync non ASCII characters (ubuntu 10.04-x86_64, db 0.7.110) 
export LANG=en_US.UTF-8 cd /home/dropbox exec sudo -H -u dropbox ./.dropbox-dist/dropbox end script 

After creating the file, run initctl and you’re set! Alternatively, if only one user of the system is running Dropbox, you can run the script as that user, replacing /home/dropbox with /home/USERNAME and sudo -H -u dropbox with sudo -H -u USERNAME

If gives the error about the job not existing, although this time it says: Unknown job: dropbox

Put the content of the script on: /etc/init/dropbox.conf

(The latter version is for Ubuntu 10.4 and, presumably, later versions.)


Click here for the Fedora/RedHat init.d script. Save it to /etc/init.d/dropbox.

Add the file /etc/sysconfig/dropbox with one line setting the variable DROPBOX_USERS to include all users that want to run dropboxd in quotes and separated by spaces.

$ cat /etc/sysconfig/dropbox DROPBOX_USERS="user1 user2"

Fix file permissions:

$ /bin/chmod 0755 /etc/init.d/dropbox $ /bin/chmod 0644 /etc/sysconfig/dropbox $ /bin/ls -l /etc/init.d/dropbox /etc/sysconfig/dropbox 

Fix SELinux permissions:

$ /usr/bin/chcon -u system_u -t initrc_exec_t /etc/init.d/dropbox
$ /usr/bin/chcon -u system_u -t etc_t /etc/sysconfig/dropbox $ /bin/ls -lZ /etc/init.d/dropbox /etc/sysconfig/dropbox 

For Fedora/RedHat run:

$ chkconfig dropbox on

Verify it worked. You should see dropbox in the list.

$ chkconfig --list | egrep '3:on|5:on' | less 

In Fedora 15 or other systems using systemd, add the following as the first line in the init.d script:


Click here for the Gentoo \init.d\ scripts.

rc-update add dropbox default
openSuse 11.3

Click here for the openSuse \init.d\ scripts.

Via http://www.dropboxwiki.com

Related Posts with Thumbnails

Comments are closed.

Free WordPress Theme