Dropbox with a Custom Sync Directory
How to install Dropbox on an Ubuntu-based distro and configure it to sync to a non-default directory — including the nautilus-dropbox CLI workaround.
What This Guide Achieves
| Goal | Status |
|---|---|
| Install Dropbox on an Ubuntu-based distro | Done |
| Sync Dropbox files to a custom directory (not ~/Dropbox) | Done |
| Get Nautilus file manager integration (sync icons, right-click menu) | Done |
| Link your Dropbox account via browser | Done |
Prerequisites
- Any Ubuntu 24.04-based distro
- Internet connection
- A working web browser (Firefox, Chrome, or Edge)
- The target directory should be on a partition that is mounted whenever Dropbox starts. The tested setup used an internal partition; removable external drives are a riskier choice for always-on sync.
The Problem (Windows User Perspective)
On Windows, you download Dropbox, install it, and choose where to put your Dropbox folder during setup. On Linux, there’s no official GUI installer — Dropbox provides a “headless” daemon that you install from the terminal. By default, it creates a Dropbox folder in your home directory (~/Dropbox). If you want your files somewhere else (like a separate partition), you need to set that up before the first run.
Solution
Option A: GUI Method with Nautilus Integration (Recommended)
This is the simplest approach — one command gives you Dropbox with full file manager integration:
sudo apt update
sudo apt install nautilus-dropbox -y
This installs:
- The Dropbox daemon
- Nautilus file manager integration (sync status icons on files)
- System tray icon
- Right-click Dropbox menu in Files
Relaunch the file manager:
nautilus -q
Dropbox will appear in your system tray. Sign in and it will sync to ~/Dropbox by default.
To use a custom directory with this method, use the symlink approach after initial sync:
# Stop Dropbox first
dropbox stop
# Move the folder to your desired location
mv ~/Dropbox /mmh/Dropbox
# Create a symlink so Dropbox thinks the folder is still in ~/
ln -s /mmh/Dropbox ~/Dropbox
# Restart
dropbox start
Option B: Headless Install with Custom Path (Advanced)
This method lets you set the Dropbox folder location before the first sync, avoiding any file moving.
Step 1 — Download and extract the Dropbox daemon
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
This creates a .dropbox-dist folder in your home directory containing the daemon.
Step 2 — Create your target folder
mkdir -p /mmh/Dropbox
Replace /mmh/Dropbox with wherever you want your files. Prefer a location that is mounted every time you log in. In the tested setup, that meant an internal partition rather than a removable USB drive.
Step 3 — Start the daemon with custom path
DROPBOX_PATH=/mmh/Dropbox ~/.dropbox-dist/dropboxd
The DROPBOX_PATH environment variable tells Dropbox where to create its sync folder.
Step 4 — Link your account
The daemon needs to be linked to your Dropbox account. It should print a URL like:
To link this computer to a Dropbox account, visit the following url:
https://www.dropbox.com/cli_link_nonce?nonce=xxxxxxxx
If the URL doesn’t appear in the terminal output, open a new terminal and run:
# Download the CLI control script first
wget -O ~/dropbox.py "https://www.dropbox.com/download?dl=packages/dropbox.py"
chmod +x ~/dropbox.py
# Get the linking URL
~/dropbox.py status
Copy the URL and paste it in your browser. Log into your Dropbox account. The daemon will start syncing automatically.
Note: The linking URL (nonce) expires quickly. Don’t run
statusagain before visiting the URL — each call generates a new nonce that invalidates the previous one.
Step 5 — Verify sync is working
~/dropbox.py status
# Should show "Syncing..." or "Up to date"
ls /mmh/Dropbox
# Your Dropbox files should appear here
Step 6 — Set up the CLI shortcut
sudo ln -s ~/dropbox.py /usr/local/bin/dropbox
Now you can control Dropbox from anywhere:
dropbox start # Start the daemon
dropbox stop # Stop the daemon
dropbox status # Check sync status
Step 7 — Auto-start on boot (Optional)
Create a systemd service:
sudo nano /etc/systemd/system/dropbox.service
Paste:
[Unit]
Description=Dropbox Daemon
After=network.target
[Service]
User=mohsin
Environment=DROPBOX_PATH=/mmh/Dropbox
ExecStart=/home/mohsin/.dropbox-dist/dropboxd
Restart=on-failure
[Install]
WantedBy=multi-user.target
Replace mohsin with your username (check with whoami).
Enable it:
sudo systemctl daemon-reload
sudo systemctl enable dropbox
sudo systemctl start dropbox
What Didn’t Work (and Why)
| Approach Tried | Why It Failed |
|---|---|
| Moving an existing large Dropbox folder to a new location | Takes extremely long for large folders — set the path before first run instead |
| Clicking the terminal URL to open browser | Some terminal emulators don’t support click-to-open URLs by default — copy/paste the URL into your browser manually |
Running dropbox status before downloading dropbox.py | The dropbox command isn’t available until you install nautilus-dropbox or download dropbox.py |
Running ~/dropbox.py status multiple times to get the linking URL | Each call generates a new nonce that invalidates the previous one — visit the URL immediately |
| Trying to use a removable external USB drive for Dropbox sync | In this workflow the drive may not be mounted when Dropbox starts, so an always-available location is the safer default |
Verification
# Check Dropbox is running
dropbox status
# Expected: "Up to date" or "Syncing..."
# Check files are in the right location
ls /mmh/Dropbox
# Check Dropbox config (if using headless install)
cat ~/.dropbox/info.json
# Should show your chosen path
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Command 'dropbox' not found | CLI script not installed | Run sudo apt install nautilus-dropbox or download dropbox.py |
| Daemon starts but no linking URL appears | URL may have opened in browser automatically | Check your browser for an open Dropbox tab |
info.json: No such file or directory | Account not linked yet | Re-run daemon and visit the linking URL |
| Flatpak repo error in terminal output | Unrelated to Dropbox — a separate Flatpak issue | Ignore it, doesn’t affect Dropbox |
/mmh/Dropbox folder is empty after linking | Sync hasn’t started or path wasn’t set correctly | Check ~/dropbox.py status and verify DROPBOX_PATH was set |
Complete Removal
# Stop Dropbox
dropbox stop
# Remove the daemon
rm -rf ~/.dropbox-dist
# Remove Dropbox config
rm -rf ~/.dropbox
# Remove Nautilus integration (if installed)
sudo apt remove nautilus-dropbox
# Remove the sync folder (CAUTION: deletes all local Dropbox files)
# rm -rf /mmh/Dropbox
# Remove CLI shortcut
sudo rm /usr/local/bin/dropbox
rm ~/dropbox.py
# Remove systemd service (if created)
sudo systemctl stop dropbox
sudo systemctl disable dropbox
sudo rm /etc/systemd/system/dropbox.service
sudo systemctl daemon-reload
Related Guides
- Google Drive: Multiple Accounts — rclone setup for Google Drive
- Filesystem Hierarchy — Understanding where files go on Linux
- Package Management Basics — apt vs snap vs flatpak
Discussion