Dropbox is one of the few major Cloud storage providers to offer a Linux client. It is normally set up as a GUI application but with the help of the Dropbox CLI tool it can be used fully from Command Line. This is particularly useful for headless servers. First step is to create a Dropbox account that will be later used to link to the Dropbox Linux Client.
Install Dropbox and Command Line Interface
Install Dropbox with packer.
packer -S dropbox
Install Dropbox Command Line Interface with packer.
packer -S dropbox-cli
Link Dropbox Account
Run Dropbox for the first time.
You should see This computer isn’t linked to any Dropbox account… followed by a link. Copy the link, open it on any computer and follow the simple instructions provided to link the account.
If Dropbox is already running you will get Another instance of Dropbox (xxxxx) is running! message. First make sure you are attempting to run Dropbox while logged in with the correct account. If you still receive the message make sure Dropbox is not started by systemd with
systemctl stop [email protected]. In case you still get the message try to
reboot and possibly run
systemctl disable [email protected] to disable automatic start on boot until Dropbox account is linked.
Start Dropbox with systemd.
sudo systemctl start [email protected]
The at symbol (@) means that the service can have multiple instances. The symbol is followed by an instance identifier string in this case it is the username
Enable Dropbox service to run on boot.
sudo systemctl enable [email protected]
Multiple instances can be started on boot by substituting the username after the at symbol.
One downside to Dropbox is that there is no built-in method to change default sync directory. While Dropbox sync directory can be moved, new sync directories cannot be created. A workaround is to create symbolic links that point to directories that are to be synced.
Create symbolic links to sync directories.
ln -s /mnt/virtual/homes/dom/*/ /home/dom/Dropbox
Asterisk (*) will create a symbolic link for each file and directory within the preceding path. Unfortunately this method will not automatically create links to newly created files or directories unless they are in one of the sub-directories with an existing soft link. The last asterisk and slash can be removed to add just a single directory in which case any new files or directories within it will be automatically synced.
Quickly remove all symbolic links from current directory in case unwanted links were created.
find -type l -delete
Use Dropbox with Command Line Interface
List Dropbox Command Line Interface commands.
If you see Waiting to be linked to a Dropbox account… message, make sure Dropbox account is linked and you are logged in as the correct user.
Check the current sync status.
Change current directory to the default Dropbox sync directory.
Check the current sync status of the current directory.