Dropbox

Dropbox is an extremely easy-to-use tool for sharing files and syncing them between computers, and you can also use Dropbox to back up files and access them from other computers and devices.

This How-to Installs and Configure Dropbox on Ubuntu Server 14.04.

Installing Dropbox on Ubuntu Server

Download Dropbox via the official Dropbox site:

Dropbox for 32-bit Architecture

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

Dropbox for 64-bit Architecture

wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86_64"

Extract the downloaded archive with command below

tar -zxvf dropbox.tar.gz

Run the dropbox client daemon on with the command below:

~/.dropbox-dist/dropboxd

Sync Ubuntu Server with Your Dropbox Account

If your Ubuntu server is not linked to a Dropbox account yet, so you will see a message like the following every few seconds:

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

################################ will be replaced by your unique host_id value.

Now copy and paste the link to any web browser (on any computer) so that it will start to link this machine to your Dropbox account. You will be asked to provide your username and password in order to link to your Dropbox account.

If the Dropbox client on your server is successfully synced, you will see the message "Client successfully linked, Welcome!" and it will stop printing the authorization link. It also will automatically create a Dropbox folder under ~/Dropbox for the user you are logged in as. Press CTRL + C to terminate the Dropbox daemon process.

How to Make Dropbox Start up Automatically on Boot

Create a new file in directory /etc/init.d/ called "dropbox" for the service management script

sudo nano /etc/init.d/dropbox

Paste the following script into the file /etc/init.d/dropbox

#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox clients for

### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: dropbox service
### END INIT INFO

DROPBOX_USERS="user1 user2"

DAEMON=.dropbox-dist/dropboxd
start() {
 echo "Starting dropbox..."
 for dbuser in $DROPBOX_USERS; do
 HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
 if [ -x $HOMEDIR/$DAEMON ]; then
 HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
 fi
 done
}

stop() {
 echo "Stopping dropbox..."
 for dbuser in $DROPBOX_USERS; do
 HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
 if [ -x $HOMEDIR/$DAEMON ]; then
 start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
 fi
 done
}

status() {
 for dbuser in $DROPBOX_USERS; do
 dbpid=`pgrep -u $dbuser dropbox`
 if [ -z $dbpid ] ; then
 echo "dropboxd for USER $dbuser: not running."
 else
 echo "dropboxd for USER $dbuser: running (pid $dbpid)"
 fi
 done
}

case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 restart|reload|force-reload)
 stop
 start
 ;;
 status)
 status
 ;;
 *)
 echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
 exit 1
 esac

exit 0

NOTE: Change the user name in the above script to your Ubuntu login user name

Make sure the script is executable and add it to default system startup run levels

sudo chmod +x /etc/init.d/dropbox

sudo update-rc.d dropbox defaults

Control the Dropbox client like any other Ubuntu service

sudo service dropbox start|stop|reload|force-reload|restart|status

How to Check Status Dropbox with Dropbox Python Script

Download the dropbox.py script and make the file executable

wget -O ~/.dropbox/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"

chmod +x ~/.dropbox/dropbox.py

Now you can easily check the status of the Dropbox client with following command

~/.dropbox/dropbox.py status

Get more help dropbox.py with following command

~/.dropbox/dropbox.py help

See Also

Dropbox (last edited 2017-09-04 01:24:46 by ckimes)