Install rclone

The official installer is a single curl-pipe-bash, which always feels questionable but in this case is fine because they sign their releases:

curl https://rclone.org/install.sh | sudo bash

If you'd rather not, every distro packages it (sudo apt install rclone / sudo dnf install rclone). The packaged version is sometimes a major release behind, but the OneDrive backend has been stable for years — it doesn't matter much.

Configure a OneDrive remote

rclone config

Walk through:

  1. n for new remote.
  2. Name: onedrive (or whatever you want).
  3. Storage: type onedrive — rclone will autocomplete from the long list.
  4. Client ID and secret: leave blank. rclone has its own registered app.
  5. Region: global for personal OneDrive; us, de, or cn for Office 365 in those regions.
  6. Edit advanced config: n unless you have a specific reason.
  7. Use auto config: y if you're at a desktop with a browser, n on a headless server (see below).

The headless server trick

If you're on a server with no browser, choose n on the auto-config step. rclone prints a one-shot command to run on a desktop machine that does have a browser:

# On the headless server:
y/n> n
For this to work, you will need rclone available on a machine that has
a web browser available. Then run:
  rclone authorize "onedrive"
Then paste the result below.

Run that rclone authorize "onedrive" on your desktop, complete the OAuth flow in the browser, then paste the resulting token (a single huge JSON blob) back into the headless prompt. Done.

Continue:

  1. Type of account: 1 for personal/business OneDrive (2 for SharePoint, etc.).
  2. rclone will list the available drives. Almost always just 0 for the default.
  3. Confirm with y.

Verify access

rclone lsd onedrive:                # list top-level directories
rclone size onedrive:               # tell me how big this account actually is
rclone tree onedrive:Documents      # ASCII tree of a folder

Mount it as a regular directory

mkdir -p ~/OneDrive
rclone mount onedrive: ~/OneDrive --vfs-cache-mode full --daemon

What the flags do:

  • --vfs-cache-mode full — full read/write semantics. Files are cached locally on first read; writes go to the cache and are uploaded asynchronously. The closest you can get to "normal POSIX" against a remote object store.
  • --daemon — run in the background. Without this, the foreground process holds your terminal.
  • Other useful options: --vfs-cache-max-size 10G caps the local cache, --vfs-cache-max-age 24h evicts older entries, --allow-other lets other users on the box read the mount (requires user_allow_other in /etc/fuse.conf).

To unmount:

fusermount -u ~/OneDrive

Make it persistent (systemd user service)

mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/onedrive-mount.service <<'EOF'
[Unit]
Description=rclone mount of OneDrive
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount onedrive: %h/OneDrive --vfs-cache-mode full --vfs-cache-max-size 5G --log-level NOTICE
ExecStop=/bin/fusermount -u %h/OneDrive
Restart=on-failure
RestartSec=10

[Install]
WantedBy=default.target
EOF

systemctl --user daemon-reload
systemctl --user enable --now onedrive-mount.service

It now mounts on login and survives session restarts. journalctl --user -u onedrive-mount -f tails the log if you need to debug.

Or just sync, no mount

If you don't need a live mount, mirror is simpler and faster:

mkdir -p ~/OneDriveBackup
rclone sync onedrive: ~/OneDriveBackup --progress --transfers 4 --checkers 8

sync is one-way; copy won't delete anything on the destination. --transfers 4 limits concurrency — OneDrive throttles aggressively if you go higher (you'll see HTTP 429 in the log).

Why this came up

The original version of this post was written because Microsoft was preparing to start charging for OneDrive storage that had previously been free, and I wanted to extract everything before the deadline. If you're in that situation in 2026 (it has happened a few times), the same recipe applies.