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:
- n for new remote.
- Name:
onedrive(or whatever you want). - Storage: type
onedrive— rclone will autocomplete from the long list. - Client ID and secret: leave blank. rclone has its own registered app.
- Region:
globalfor personal OneDrive;us,de, orcnfor Office 365 in those regions. - Edit advanced config: n unless you have a specific reason.
- 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:
- Type of account:
1for personal/business OneDrive (2for SharePoint, etc.). - rclone will list the available drives. Almost always just
0for the default. - 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 10Gcaps the local cache,--vfs-cache-max-age 24hevicts older entries,--allow-otherlets other users on the box read the mount (requiresuser_allow_otherin/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.