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: 23 Average: 4.6]

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

  • Chris Rasmussen
    5 days 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?

    • Xiao Guoan (Admin)
      4 years ago

      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
      4 years 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
    4 years 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

    • Xiao Guoan (Admin)
      4 years ago

      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

    • Xiao Guoan (Admin)
      4 years ago

      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
    4 years 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

    • Xiao Guoan (Admin)
      4 years ago

      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
        4 years 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
    4 years 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,

    • Xiao Guoan (Admin)
      4 years ago

      You need to remove the Dropbox config file under your home directory.

      rm ~/.dropbox/ -r
  • seansen
    4 years ago

    I get an Exec format error. Thx in advance

    ubuntu@ubuntu:~$ /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
    4 years 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?

    • Xiao Guoan (Admin)
      4 years ago

      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
    4 years ago

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

    • Matthew Piccinich
      4 years 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"
  • Dave Marley
    4 years ago

    Super useful! Thanks a lot. I had come across many tutorials that said headless dropbox cannot be installed on Ubuntu 18 due to shared library issues, and was almost about to give up until I came across this tutorial. This one works like a charm.

  • funkymaster
    3 years ago

    Hi, thank you for this tutorial.
    I have a problem with Dropbox auto-updates.
    The Dropbox app does automatically download an newer version to /home/user/.dropbox-dist/
    Afterwards the app is killed by itself and restarted by systemd in the /opt/dropbox/ folder
    This results in a deadlock, because the newer version should be downloaded to /opt/dropbox/ and not to the user folder.
    How to tell Dropbox the different folder?
    If this is not possible, I think the only solution is to use the default /home/user/ and not the different /opt/ folder.

  • Hello, Xiao. Many thanks for this tutorial.
    By the way, do you know how I could sync two or more different accounts in the same server?
    Should I include something like this?

    User=username1,username2

    • Xiao Guoan (Admin)
      2 years ago

      I haven’t tried it but here’s how I would do to set up two Dropbox account on the same server.

      1. Create two users on your Linux server for each Dropbox account. (user1 & user2).

      2. Install two Dropbox to /opt/dropbox-user1/ and /opt/dropbox-user2/

      3. Create systemd service for each Dropbox account (/etc/systemd/system/dropbox-user1.service & /etc/systemd/system/dropbox-user2.service)

  • Machias
    2 years ago

    I was pleasantly surprised when all of this worked on my openSUSE Leap headless server

  • Devastator
    1 year ago

    Thank you very much.
    This is very usefull guide.
    I used that tutorial to sync my webserver htdocs on Debian distro.

  • Hi,

    I’ve done all the steps and got the link. I am installing Dropbox on an Ubuntu 22.04 Server (no GUI) on a VPS at Contabo.
    As soon as I copy/paste the link in my desktop browser I get the dropbox page stating “Error Invalid URL. Please check your client for a new one.”
    This happens every time I try to run /opt/dropbox/dropboxd command. Although the link is generated every time, the result is the same.

    How can I activate this?

    Kind regards,
    Dick.

  • I’ve managed to login to dropbox and my headless Ubuntu server is validated. But now every time I reboot I get the following error when running the command “systemctl status dropbox”:

    ○ dropbox.service – Dropbox Daemon
    Loaded: loaded (/etc/systemd/system/dropbox.service; disabled; vendor preset: enabled)
    Active: inactive (dead)
    root@vmi1371241:~# systemctl daemon-reload
    root@vmi1371241:~# systemctl status dropbox
    ○ dropbox.service – Dropbox Daemon
    Loaded: loaded (/etc/systemd/system/dropbox.service; disabled; vendor preset: enabled)
    Active: inactive (dead)
    root@vmi1371241:~# systemctl stop dropbox
    root@vmi1371241:~# systemctl daemon-reload
    root@vmi1371241:~# systemctl start dropbox
    root@vmi1371241:~# systemctl status dropbox
    × dropbox.service – Dropbox Daemon
    Loaded: loaded (/etc/systemd/system/dropbox.service; disabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Tue 2023-08-01 11:02:29 CEST; 2s ago
    Process: 1614 ExecStart=/opt/dropbox/dropboxd (code=exited, status=217/USER)
    Main PID: 1614 (code=exited, status=217/USER)
    CPU: 7ms

    Aug 01 11:02:29 vmi1371241.contaboserver.net systemd[1]: dropbox.service: Scheduled restart job, restart counter is at 5.
    Aug 01 11:02:29 vmi1371241.contaboserver.net systemd[1]: Stopped Dropbox Daemon.
    Aug 01 11:02:29 vmi1371241.contaboserver.net systemd[1]: dropbox.service: Start request repeated too quickly.
    Aug 01 11:02:29 vmi1371241.contaboserver.net systemd[1]: dropbox.service: Failed with result ‘exit-code’.
    Aug 01 11:02:29 vmi1371241.contaboserver.net systemd[1]: Failed to start Dropbox Daemon.

    How can I resolve this so Dropbox starts/runs?

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. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here