The Problem
Dropbox stops syncing when no user is logged in. On a headless server or a machine that isn't always attended, this means your files go stale whenever the session ends.
The Solution
Run Dropbox as a systemd user service with loginctl enable-linger. This keeps Dropbox running at boot — no active session required.
1. Create the service file
Place this at ~/.config/systemd/user/dropbox.service:
[Unit]
Description=Dropbox Sync Service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/home/YOUR_USER/.dropbox-dist/dropboxd
Environment=HOME=/home/YOUR_USER
Environment=DISPLAY=
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.targetReplace YOUR_USER with your actual username.
2. Enable and start the service
systemctl --user enable dropbox.service
systemctl --user start dropbox.service3. Enable linger
This is the key step — it tells systemd to start your user services at boot, even without an active login session:
sudo loginctl enable-linger YOUR_USER4. Verify
systemctl --user status dropbox.service # should show active (running)
loginctl show-user YOUR_USER | grep Linger # should show Linger=yesImportant Note
Dropbox must be installed and linked to your account at least once in an interactive session before this setup works. Run dropboxd manually first, follow the authentication link, and then switch to the systemd service.