Running multiple Dropbox accounts simultaneously on a headless Linux server (with tmux or screen)

While I was setting up my home server, I realized that it would make sense to have both my and my sweetie’s Dropbox accounts sync to that machine as well so that updates would always propagate properly. Setting up multiple Dropbox accounts AND a single headless server was a bit more complicated than advertised, so I thought I’d share my experiences here. This was all done on Debian 9 Stretch, but should work with any *nix computer. (There are MacOSX instructions, but I haven’t tried them.)

Please note that I’m starting these from within a tmux session that is started by systemd. I’m not sure how you could configure the systemd units properly with this hack. (Systemd configuration for a single instance is at this guide.) If you know how, please comment so that I and others who find this guide will know. So here we go!

    1. Create two directories, replacing the accountA and accountB with whatever makes sense for you to keep them separate:
      cd ~ && mkdir $HOME/accountA && mkdir/accountB
    2. If you already have an existing Dropbox install(s) and wish to use it with this setup, move ./dropbox and /Dropbox (the default sync location) from the user’s home folder into the account folder. So in this example, I moved /home/user/.dropbox into¬† /home/user/accountA/.dropbox. After that, delete /home/user/.dropbox-dist; we don’t want to get ourselves or the daemon confused.
    3. Create a script for each user using the example at https://stevesaus.com/s/qb36w (or below) and remembering to change the path names properly to reflect what you did in the first step. These have to be separate shells, so the most foolproof way to do this is to have two separate scripts.
      #!/bin/bash
      
      unset DISPLAY
      HOME="/home/user/accountA"
      /home/user/accountA/.dropbox-dist/dropboxd

      Note that the variable DISPLAY is unset at the beginning of the script. This is important, because otherwise it’ll keep trying to connect to X and won’t give you a command line url to authenticate against. Also, it (within that script) changes the $HOME directory. I had to put the full path name and on a separate line to make it work.

    4. Change into /home/user/accountA and execute the appropriate command to download the Dropbox daemon. The only change here is so that you don’t accidentally install it in your main $HOME directory. This is for 32 bit
      wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -

      and this is for 64 bit

      wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

      Repeat this step for /home/user/accountB

    5. Once you’ve done that, run each user’s Dropbox script you created. It will give you a commandline URL to visit and authenticate the account (you can do this on another computer, so if you’re SSHing in, it’s no big deal).
    6. If you’re running tmux (or another multiplexer) you can easily have each running in a separate pane or window. By changing the $HOME directory within that shell window, the Dropbox daemon looks where you tell it to for the configuration files.

Popular posts:

  • Compersion: The Skill You Absolutely Need In Your Relationship(s).
  • Word Porn Quotes
  • SOLVED: Command line BPM (beats per minute) Analysis in Linux
  • Rules and guidelines and breaking them in polyamory
  • If there's one Nazi (or a racist) at the table...
  • Using Tasker to Sign Into WiFi Networks on Android (including Lollipop)
  • Bash string padding with SED