Friday, June 24, 2011

use multiple dropbox accounts on the same ubuntu Linux box

Hi today I run out of space in my Dropbox free account so I decided to reorder it and clean the unnecessary files... 
but I suddenly realized that the best thing would have been to have different account dedicated to different data sets so not to risk to delete something unwillingly.
So I made some researches and come out with a pretty neat solution which should in principle work with any number of account (I have basically 4): 
  1. first download a Dropbox distro, I choosed a forum build, but you can also simply install the .deb package form apt or whatever installation managers: http://forums.dropbox.com/topic.php?id=40283 (in the case you installed the distro you find the distro in .dropbox-dist in your home folder)
  2. make a dir with a name for your dropbox instance: mkdir .dropbox_<alt-name> 
  3. copy the dropbox files into an installation dir  .dropbox_<alt-name>/.dropbox-dist 
  4. run the installation for an instance with the different storage dir : HOME=~/.dropbox_<alt-name> .dropbox_<alt-name>/.dropbox-dist/dropbox -i &
  5. (for lazy people like me) as root prepare a script /usr/bin/dropboxMulti adjusting your directories (mine will start 5 instances): 
    1. if ([ "$#" -ne 1 ])
    2. then
    3.     echo "Usage: $0 start/stop"
    4.     echo
    5.     echo "This script will start multiple dropbox instances and can cause an intense usage of network bandwidth "
    6.     echo ""
    7.     exit 1
    8. fi

    9. ACTION=$1

    10. #. starts the original one

    11. dropboxes=". .dropbox-epfl .dropbox-musica .dropbox-photo .dropbox-pdf "
    12. for dropbox in $dropboxes
    13.   do
    14.       HOME=/home/$USER
    15.       if ! [ -d $HOME/$dropbox ];then
    16.           mkdir $HOME/$dropbox 2> /dev/null
    17.           ln -s $HOME/.Xauthority $HOME/$dropbox/ 2> /dev/null
    18.       fi

    19.       HOME=$HOME/$dropbox /usr/bin/dropbox $ACTION 2> /dev/null &
    20.   done
  6. sudo chmod +x /usr/bin/dropboxMulti to make it executable
  7. to make it run at boot edit /etc/rc.local as root :
su <your user name> -c "/usr/bin/dropboxMulti start" 


enjoy Dropbox 

Alex Barchiesi 

3 comments:

  1. How To Run Multiple Dropbox Accounts Simultaneously [Mac]
    (stolen freely from a Jeffry Thurana tutorial)
    I'm using MAC now since a while also so the need to run several DBox account on the same machine.
    Before you start, you need to create an additional account with Dropbox.

    There are two steps that need to be taken. The first step is setting up the account.
    Open Terminal
    Type (or just copy and paste) this command:
    bash
    Hit enter and insert the next command line:
    HOME=$HOME/.dropbox-alt /Applications/Dropbox.app/Contents/MacOS/Dropbox &
    Here’s how it looks like.

    A new Dropbox icon will appear in the menubar.

    A Dropbox account setup window will also pop up. Follow the setup steps.

    At the last setup step, tick the option to choose your own location of Dropbox folder. Hit the “Change” button to determine the location.

    After the setup process complete, you can close the terminal. Theoretically, the extra Dropbox instances will also be closed, but in my experiment it remained in the menubar.
    That’s the end of step 1.

    Second step: creating the startup item for the extra Dropbox instance.
    Open the Terminal (again)
    Paste in this command line:
    mkdir -p ~/wherever you like/DropboxAltStarter.app/Contents/MacOS/
    In place of “wherever you like” really does mean anywhere on your hard drive that you like, such as ~/Documents/.

    In this step, you are creating an application called “DropboxAltStarter“. But it’s not completed yet.

    Then open TextEdit and paste:




    CFBundlePackageType
    APPL
    CFBundleExecutable
    DropboxAltStarter
    LSUIElement
    1


    Save the file as: “Info.plist” anywhere.
    (Please note that the above should be written within one line of code – separated by a space, but we need to break it down into two because it couldn’t fit into the WP theme. So don’t forget to enter it in one line).

    Right click on the “DropboxAltStarter” that you’ve created before and choose “Show Package Contents”

    Drag and drop the “Info.plist” file into the folder “Contents” (the same level as “MacOS” folder).


    Create a new text file and paste:
    #!/bin/bash
    HOME=/Users/$USER/.dropbox-alt
    /Applications/Dropbox.app/Contents/MacOS/Dropbox
    (Again, the HOME=/Users/$USER/.dropbox-alt and /Applications/Dropbox.app/Contents/MacOS/Dropbox should be written in one line of code separated by a space. You know what to do.)
    Then save the file as “DropboxAltStarter” (sans quote). Don’t forget to uncheck the “If no extension is provided, use “.txt”” box to prevent TextEdit from saving the file as text file.

    Repeat steps 4 and 5 above to put the “DropboxAltStarter” file into the “MacOS” folder.

    Open Terminal and type this command:
    chmod 755
    Before you hit enter, drag and drop the “DropboxAltStarter” file to the Terminal to finish the command.

    Then hit enter.

    Now you have a working app. You can move it to the “Applications” folder if you like, double click it to open the second dropbox account.

    You can also add the newly created app to your start up list by going to “System Preferences > Accounts > Login Items” menu.

    there’s still one thing to add: To know which Dropbox account is which, you can assign different logo to one of them. Go to Dropbox’ “Preferences > General” and choose the B&W logo for one of the accounts.

    If you are a Windows user, you can use Dropbox addon called Dropboxen to achieve the same result.

    ReplyDelete
  2. Thanks for instructions, they worked for me.

    ReplyDelete
  3. I noticed an error due to the formatting of the MAC post that removed all the <>:

    Here I try again with the Info.plist file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleExecutable</key>
    <string>DropboxCalibreStarter</string>
    <key>LSUIElement</key>
    <string>1</string>
    </dict>
    </plist>

    ReplyDelete