Dropbox

From ArchWiki
Revision as of 02:16, 26 February 2011 by Cedeel (Talk | contribs) (Without Nautilus (Another Way))

Jump to: navigation, search

Dropbox is a file sharing system that recently introduced a GNU/Linux client. Use it to transparently sync files across computers and architectures. Simply drop files into your "~/Dropbox" folder, and they will automatically sync to your centralized repository.

Installation

dropbox can be installed from the AUR. Alternatively, dropbox-experimental is also available.

  1. After installing the package, you can start Dropbox from your application menu or run "dropboxd" from the command-line. The client icon will appear in the system tray.
  2. Eventually a popup will ask you to login to your Dropbox account, or start a new one. Enter your credentials.
  3. After some time you will see a "Welcome to Dropbox" popup, which will give you the opportunity to view a short tour of Dropbox.
  4. Press the "Finish and go to My Dropbox".

Optional packages

  • For a command-line interface, install dropbox-cli from the AUR.
  • For integration with nautilus, install nautilus-dropbox from the AUR. The nautilus plugin will start dropbox automatically.
  • For integration with thunar, install thunar-dropbox from the AUR.
  • For KDE users, there is KDE client available: kfilebox from AUR.

Autostart

Dropbox can be autostarted by adding dropboxd to .xinitrc (or autostart.sh, depending on your setup). Alternatively, you can start it as a daemon.

Alternative to install: use the web interface

If all you need is basic access to the files in a dropbox, you can use the web interface at http://dropbox.com to upload and download files to your dropbox. This can be a viable alternative to running a dropbox daemon and mirroring all the files on your own machine.

Daemon

To run dropbox as a daemon like sshd or vsftpd, simply do the following:

As root, copy this into a file called /etc/rc.d/dropboxd and set USER to your username.

#!/bin/bash

USER=yourusername

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID /opt/dropbox/dropbox`

case "$1" in
  start)
    stat_busy "Starting Dropbox Service"
    [ -z "$PID" ] && su -c "/usr/bin/dropboxd &" $USER
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon dropboxd
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping Dropbox Service"
    [ ! -z "$PID" ] && kill $PID > /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon dropboxd
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 3
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
    ;;
esac
exit 0

Make the file executable with

# chmod +x /etc/rc.d/dropboxd

This allows you to start or stop dropboxd just like any other service. place it in the daemons array in rc.conf for it to start at boot.

# /etc/rc.d/dropboxd start
# /etc/rc.d/dropboxd stop
# /etc/rc.d/dropboxd restart

And in rc.conf:

DAEMONS=(... @dropboxd ...)

Without Nautilus (Another Way)

Another way to use Dropbox without Nautilus but with another file manager like Thunar is described below:

1. Create a fake Nautilus script that will launch Thunar:

   $ sudo touch /usr/bin/nautilus && sudo chmod +x /usr/bin/nautilus && sudo nano /usr/bin/nautilus

2. Insert this text into the file, then save and exit:

   #!/bin/bash
   exec thunar $2
   exit 0

3. Launch Dropbox

   $ dropboxd

4. Click on the dropbox tray icon to open your dropbox folder in Thunar.

Note: In this way there is no need to create a dropbox daemon in /etc/rc.d and to start it at boot via /etc/rc.conf or to make it start via your session manager: just leave the "Start dropbox on system startup" option flagged in the Preferences window.
Note: If you already have nautilus instaled but don't want to use it, neither modify the existing file under /usr/bin, just change the /usr/bin for /opt/dropbox in the step 2 above, like this: $ sudo touch /opt/dropbox/nautilus && sudo chmod +x /opt/dropbox/nautilus && sudo nano /opt/dropbox/nautilus. Dropbox will look this path first!

Securing your Dropbox

If you want to store sensitive data in your Dropbox, you should encrypt it before. Syncing to Dropbox is encrypted, but all files are (for the time being) stored on the server just as you put them in your Dropbox.

  • Dropbox works with Truecrypt, and after you initially uploaded the Truecrypt volume to Dropbox, performance is quite ok, because of Dropbox has a working binary diff.
  • Another possibility is to use EncFS, which has the advantage that all files are encrypted separately, i.e. you don't have to determine in advance the size of the content you want to encrypt and your encrypted directory grows and shrinks while you add/delete/modify files in it. You can also mount an encrypted volume at startup using the -S option of encfs to avoid having to input the passphrase, but note that your encrypted files are not secure from someone who has direct access to your computer.

Multiple dropbox instances

If you need to separate or distinguish your data, personal and work usage for example, you can subscribe to dropbox with different email addresses and have multiple directories synced to different instances.

The basic principle and general howto are described in the Dropbox Wiki.

Only thing to keep in mind: when dealing with multiple instances you have to select the dropbox destination folder, which the dropbox installer asks in the last step; usage examples may be /home/dropbox-personal, /home/dropbox-work and so on.

For convenience, here is a script that I use to accomplish the task: just add a dir in the "dropboxes" list to have another instance of dropbox, referring to the dir, loaded at script startup.

 #!/bin/bash

 #*******************************
 # Multiple dropbox instances
 #*******************************

 dropboxes=".dropbox-personal .dropbox-work"

 for dropbox in $dropboxes
 do
     if ! [ -d $HOME/$dropbox ];then
         mkdir $HOME/$dropbox
     fi
     HOME=$HOME/$dropbox /usr/bin/dropbox start -i
 done

Dropbox on laptops

Dropbox itself is pretty good at dealing with connectivity problems. If you have a laptop and roam between different network environments, dropbox will have problems reconnecting if you do not restart it. The easiest way to solve this with netcfg is to use POST_UP and PRE_DOWN.

In every network profile you use, add the appropriate commands:

POST_UP="any other code; su -c '/usr/bin/dropboxd &' your_user"
PRE_DOWN="any other code; killall dropbox"

Obviously, your_user has to be edited and 'any other code;' can be omitted if you do not have any. The above will make sure that dropbox is running only if there is a network profile active.

Alternatives