How to Use Dropbox CLI for Backup Sync

Dropbox being a well-known free service lets you synchronize and share your data all over the world and no matter what computer or mobile device you are working with.

Particularly, this functionality becomes useful when it comes to backups. Interesting feature here is that you can use Dropbox CLI (stands for Command Line Interface) in any text-based Linux environment, thus significantly simplifying your life in terms of data safety.

The only important pre-requisite you should be aware of is Python 2.6 or higher. You can install it to a separate directory not to break your current Python installation (if any).

Assuming you’re already registered at, let’s follow a few simple steps below to get the whole thing up and running.

1. Obtain your shell prompt and download the archive which corresponds to your server architecture:




[alert]Use arch or uname -i commands to find out what hardware platform you’re running.[/alert]

2. Extract the archive and run dropboxd:

tar xzvf dropbox-lnx.x86_64-1.1.45.tar.gz

3. You will see the output message similar to this:

This client is not linked to any account… Please visit*** to link this machine.

Now copy that URL and paste it in your web browser. Next, verify your account by typing your Dropbox password.

That’s all. Now this server is linked to your account and you can manage it through the web interface (Account -> My Computers tab). Also, the directory ‘~/Dropbox’ is created on the server and your files start syncing immediately.

4. Here we’ll perform some steps to implement easy-to-use philosophy of managing the Dropbox installation.

Download the following script to one of your $PATH directories.

cd /usr/bin


mv dropbox

chmod 0700 dropbox

Type ‘dropbox’ to see all available options provided by this script.

[alert]If you saw ‘invalid syntax’ errors while running this script – open the script with your favorite editor and edit the shebang line ‘#!/usr/bin/python’ to match your valid Python 2.6+ installation path, i. e. ‘#!/opt/python26′.[/alert]

6. Being a Dropbox user you’re probably aware of the ‘LAN sync’ option. We’re going to disable this feature as most likely you do not manage a LAN and therefore don’t require this. Use the following commands:

dropbox stop

cd /usr/bin


chmod 0700



chmod 0700 off

dropbox start

7. Let’s enable autoloading and create the init script.

Debian-based distributive (like Ubuntu):

cd /etc/init.d


mv dropbox_debian dropbox

chmod 0700 dropbox

update-rc.d dropbox defaults


RedHat-based distributive (like CentOS):

cd /etc/init.d


mv dropbox_redhat dropbox

chmod 0700 dropbox

echo 'DROPBOX_USERS="root"' > /etc/sysconfig/dropbox

chkconfig dropbox on

Where ‘root’ is the user under which you’re running your Dropbox. You might want to create a different user for security reasons.

We’re all set. Copy any file to ‘~/Dropbox’ directory and it will be synchronized within a moment to Dropbox cloud.

You might also want to add a cron job to have some specific directories synchronized automatically within the specific time frames. If you tried everything and for some strange reason a directory is not synced – try sharing it using Dropbox web interface.

Was this article helpful?
Spread the word!