
Microsoft does not make an official OneDrive app for Linux, but you can still sync, back up and mount OneDrive on a Linux desktop or a headless server. The two best free tools are the open-source OneDrive Client for Linux (by abraunegg), which keeps a local folder in sync like the Windows app, and rclone, which copies files to OneDrive or mounts it as a drive. This guide explains when to use each, how to install and authorize them on a server without a browser, how to run them as a service, and the limits to be aware of.
Quick answerFor two-way sync of a folder, install the OneDrive Client for Linux, run onedrive once to authorize, then onedrive --sync or run it continuously with onedrive --monitor. For backups to OneDrive or mounting it, use rclone config to add a OneDrive remote, then rclone copy or rclone mount.
Why use OneDrive on a Linux server?
- Off-site backups of websites, databases and configuration to storage you already pay for with Microsoft 365.
- Sharing generated reports or exports with colleagues who use OneDrive or SharePoint.
- Keeping the same documents on a Linux workstation and Windows PCs.
Option 1: OneDrive Client for Linux (two-way sync)
This free, actively maintained client supports OneDrive Personal, OneDrive for Business (Microsoft 365) and SharePoint document libraries. It keeps a local folder (by default ~/OneDrive) in sync with the cloud.
Install
Ubuntu and Debian include a onedrive package, but it is often several versions old. The project's installation guide recommends its own package repository for Ubuntu and Debian, which provides the current 2.5.x release; follow the instructions for your release there. On Fedora, sudo dnf install onedrive is usually up to date. Check the version with:
onedrive --version
Do not mix 2.4.x and 2.5.x clients on the same account; 2.5 changed the database format.
Authorize on a headless server
- Run
onedriveas the user who will own the files. - The client prints a Microsoft sign-in URL. Open it in a browser on any computer and sign in.
- After signing in, the browser lands on a blank page. Copy that page's full address from the address bar.
- Paste it back into the terminal. The client saves a refresh token and is now authorized.
Sync
onedrive --sync --dry-run # preview what would happen
onedrive --sync # one-time two-way sync
onedrive --sync --upload-only --sync-dir /var/backups/site # push backups only
Use --dry-run first, especially if the OneDrive account already contains files. Settings such as the sync directory, skipped files and upload-only mode can be set permanently in ~/.config/onedrive/config, and specific folders can be chosen with a sync_list file.
Run continuously as a service
systemctl --user enable --now onedrive
loginctl enable-linger $USER # keep it running when you are logged out
journalctl --user -u onedrive -f
The service runs onedrive --monitor, which watches the local folder and checks OneDrive for changes regularly.
Option 2: rclone (backups and mounts)
rclone is a command-line tool for more than 70 cloud storage services, including OneDrive and SharePoint. It is ideal for scripted backups and for mounting OneDrive as a folder.
sudo apt install rclone # or the newer version from rclone.org
rclone config
In the wizard, choose n for a new remote, name it (for example onedrive), pick Microsoft OneDrive, accept the defaults, and answer n to "Use auto config?" on a headless server. rclone then tells you to run rclone authorize "onedrive" on a computer with a browser and paste the resulting token back.
rclone lsd onedrive: # list folders
rclone copy /var/backups onedrive:Backups -P # upload backups
rclone sync onedrive:Docs ~/Docs # make a local copy match OneDrive
rclone mount onedrive: ~/OneDrive --vfs-cache-mode writes --daemon
Be careful with rclone sync: it deletes files at the destination that are not in the source. Use copy when in doubt, and add --dry-run to test. Mounting needs FUSE (sudo apt install fuse3).
Which tool should you choose?
- A folder that stays in sync both ways: OneDrive Client for Linux.
- Nightly backups to OneDrive, or occasional access: rclone with
copyin a cron job. - Browsing OneDrive like a drive:
rclone mount. - A graphical app on a Linux desktop: OneDriveGUI (a front end for the abraunegg client) or a paid client such as Insync. The OneDrive website also works in any browser.
Limits to know
- There is no "Files On-Demand" placeholder feature like on Windows; files are either synced locally or accessed through an rclone mount.
- OneDrive does not allow some characters in file names and has path length limits; the clients skip or report such files.
- Microsoft throttles very heavy API use, so huge initial uploads can take time.
- Protect the token files (
~/.config/onedrive/and~/.config/rclone/rclone.conf): anyone who copies them can access your OneDrive.
Frequently asked questions
Is there an official OneDrive client for Linux?
No. Microsoft only provides OneDrive apps for Windows, macOS, iOS and Android, plus the web version. Open-source clients fill the gap.
Does OneDrive work on Ubuntu?
Yes, with the OneDrive Client for Linux or rclone. Both work on Ubuntu Desktop and Ubuntu Server.
Can I use OneDrive for Business and SharePoint on Linux?
Yes. Both tools support Microsoft 365 work accounts and SharePoint document libraries, though your organisation's policies may need to allow third-party apps.
Is it safe to use third-party OneDrive clients?
The OneDrive Client for Linux and rclone are open source and widely used. They use Microsoft's official API and sign-in, so they never see your password.


