How to Install Dropbox on a Headless Ubuntu Server

This tutorial will show you how to install Dropbox on a headless Ubuntu server to backup and sync files and also how to enable Dropbox to auto-start at boot time. The following steps work all current Ubuntu versions, including Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04.

Install Dropbox on Ubuntu Server

First, SSH into your Ubuntu Server. Then download Dropbox using the following command. It will be saved as dropbox-linux.tar.gz.

64 bit

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

32 bit

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

Create a directory in /opt and extract Dropbox to /opt/dropbox/.

sudo mkdir /opt/dropbox/

sudo tar xvf dropbox-linux.tar.gz --strip 1 -C /opt/dropbox

Install dependency packages for Dropbox.

sudo apt install libc6 libglapi-mesa libxdamage1 libxfixes3 libxcb-glx0 libxcb-dri2-0 libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxshmfence1 libxxf86vm1

Now you can run the Dropbox daemon.

/opt/dropbox/dropboxd

It will ask you to visit a web address in order to link your Ubuntu server with your Dropbox account.

This computer isn't linked to any Dropbox account...
Please visit https://www.dropbox.com/cli_link_nonce?nonce=d8b8aear73fawe4fbd0154443 to link this device.

Copy and paste the link in your web browser, log into your Dropbox account and click the Connect button to link your Ubuntu server with your Dropbox account.

dropbox ubuntu server

Once the link is complete, return to the terminal window and press Ctrl+C to temporarily stop Dropbox daemon because it by default runs in the foreground and you can’t run other commands. The Dropbox sync folder appears in your home directory.

How to Enable Auto-Start

To make Dropbox start at system boot time, we can create a systemd service unit.

sudo nano /etc/systemd/system/dropbox.service

Put the following lines into the file. We want Dropbox to run as a standard user instead of root, so replace username with your real username. If it runs as root user, then files in ~/Dropbox will not sync properly.

[Unit]
Description=Dropbox Daemon
After=network.target

[Service]
Type=simple
User=username
ExecStart=/opt/dropbox/dropboxd
ExecStop=/bin/kill -HUP $MAINPID
Restart=always

[Install]
WantedBy=multi-user.target

Save and close the file. Then we can start this service by running:

sudo systemctl start dropbox

And enable auto-start at system boot time.

sudo systemctl enable dropbox

Check its status.

systemctl status dropbox

dropbox ubuntu headless

Hint: If the above command doesn’t quit immediately, you can press the Q key to make it quit.

You can stop it with:

sudo systemctl stop dropbox

Restart it with:

sudo systemctl restart dropbox

Now you can restart your Ubuntu server and check if auto-start is working.

sudo shutdown -r now

That’s it! I hope this tutorial helped you install Dropbox on a headless Ubuntu server. As always, if you found this post useful, then subscribe to our free newsletter. to receive more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 18 Average: 4.4]

19 Responses to “How to Install Dropbox on a Headless Ubuntu Server

  • Chris Rasmussen
    2 years ago

    I can’t believe how long I’ve been manually typing that stupid command into the terminal.

    This method works perfectly and means I no longer have to do that. Thanks!

  • for some reason it was failing on my box.. just added some delay and it works:

    [Service]
    ExecStartPre=-/bin/sleep 30

  • “It will ask you to visit a web address in order to link your Ubuntu server with your Dropbox account.”

    Headless?

    • Yes.

      A headless computer is a computer system or device that has been configured to operate without a monitor (the missing “head”), keyboard, and mouse. A headless system is typically controlled over a network connection.

      You use a web browser to read this article, right? 🙂

    • Guido van Harten
      2 months ago

      You can visit the web address on any computer you want. It only asks you to permit a connection between Dropbox and your headless Linux. After giving the permission, you don’t need that computer.

  • Guido van Harten
    2 months ago

    I am setting up a Nextcloud server. Nextcloud is running now. Connecting Dropbox is working fine.

    Instead of your article starting with ‘How to Enable Auto-Start’ I am looking for a way to
    * connect user #1, download its files to the Linux computer, disconnect user #1
    * moving the files to the Nextcloud’s file location of user #1
    * connect user #2, download its files to the Linux computer, disconnect user #2
    * moving the files to the Nextcloud’s file location of user #2
    etc.

    For now I don’t need to MOVE the files from Dropbox to Nextcloud, only COPY.

    Do you know an easy way to do that.

    Best regards,
    Guido

    • I don’t think you can create a script to automate the process, because each user needs to manually link Dropbox account with the computer.

      You can install the Nextcloud command-line client on the server.

      sudo apt install nextcloud-desktop-cmd

      Then sync the Dropbox folder with your Nextcloud account like below.

      nextcloudcmd ~/Dropbox  https://nextcloud.yourdomain.com
  • On which way can I check when all the files of my Dropbox are synced with my Linux computer?

    Best regards.
    Guido

    • You can check the size of your Dropbox folder. The following command will check the size of the Dropbox folder under your home directory.

      du -h ~/Dropbox/
  • Guido van Harten
    2 months ago

    I ascertain that the files of my Dropbox are MOVED to my Linux computer. I only want to copy them. For now I have to continue the use of Dropbox.
    How to avoid that the files are moved?

    Best regards,
    Guido

    • If you move your files from the Dropbox folder to your Nextcloud folder, it will surely remove those files from your Dropbox account.

      • Guido van Harten
        2 months ago

        I am testing for the most optimal configuration to store my files on Nextcloud, backup them and – if needed – restore them. That’s why I want to save my files also in Dropbox for this moment May be there a temporary option to remain my files on the Dropbox account.

  • Guido van Harten
    2 months ago

    After downloading the files from the Dropbox account of user #1, I want to switch to the Dropbox account of user #2.
    I stopped the service
    systemctl stop dropbox
    and started
    /opt/dropbox/dropboxd

    I expected Linux should ask me to visit a URL to connect user #2’s Dropbox, but it don’t as expected.

    I think I have to enter more commands. But which (and when)?

    Best regards,

  • seansen
    1 month ago

    I get an Exec format error. Thx in advance

    [email protected]:~$ /opt/dropbox/dropboxd
    /opt/dropbox/dropbox-lnx.x86_64-97.4.467/dropboxd: 15: exec: /opt/dropbox/dropbox-lnx.x86_64-97.4.467/dropbox: Exec format error

  • Michael Quinlan
    1 month ago

    This article was very helpful! I had previously installed Dropbox as a user (and subsequently removed it), so this may have impacted my results in following the steps in the article. At the step where I run:

    ‘/opt/dropbox/dropboxd’

    the process would never get to the point of displaying the URL to visit. I had to prefix the command with ‘sudo ‘ to complete the process.

    Everything seems to be working fine, but I’m still wondering:

    1. Was this a result of my prior installation/removal of Dropbox?
    2. Is this requirement missing in the article?

    • The /opt/dropbox/dropboxd command doesn’t require sudo priviledge. However, if you have previously installed Dropbox, you need to remove the Dropbox config files from your home directory before running the /opt/dropbox/dropboxd command.

      rm ~/.dropbox/ -r

      If you use sudo, Dropbox thinks it’s a different user and it will create new configuration files under /root/.dropbox/ directory.

  • Atazmak
    1 month ago

    I’d like to sync just one Dropbox folder, not the entire account. Does anybody know if it’s possible?

    • Matthew Piccinich
      4 weeks ago

      Yes, By default dropbox is installed and connected to your account it will begin to sync all of the folders that are uploaded to the dropbox account to the ~/Dropbox directory. What you will need to do is add the folders you do not want to be synced to the Ubuntu Server to dropbox’s exclusion list. This is done with the command

      dropbox exclude add "/home/username/Dropbox/Foldertoexclude"

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.


The maximum upload file size: 2 MB.
You can upload: image.