
Yes, you can absolutely use OneDrive on a Linux server, although Microsoft doesn’t provide an official OneDrive client for Linux. Thanks to the open-source community, several tools and methods are available to sync and manage your OneDrive files seamlessly on Linux-based systems, including headless servers.
Why Use OneDrive on Linux?
Many developers and administrators prefer to integrate cloud storage like OneDrive into their Linux servers for purposes such as:
Automated backups
File sharing between systems
Cross-platform synchronization
Storage expansion without managing additional hardware
How to Use OneDrive on a Linux Server
The most popular and reliable tool for this task is onedrive
, an open-source CLI client developed by a community of contributors.
Step-by-Step Guide to Set Up OneDrive on Linux:
1. Install Required Packages
On Ubuntu/Debian:
sudo apt install build-essential libcurl4-openssl-dev libsqlite3-dev pkg-config git
On CentOS/RHEL:
sudo yum groupinstall "Development Tools"
sudo yum install libcurl-devel sqlite-devel
2. Clone the onedrive Repository
git clone https://github.com/abraunegg/onedrive.git
cd onedrive
./configure
make
sudo make install
3. Authorize OneDrive Account
Run:
onedrive
You’ll receive a URL. Open it in a browser, log in with your Microsoft account, and paste the authorization code back into the terminal.
4. Start Syncing
For a one-time sync:
onedrive --synchronize
To enable automatic syncing:
systemctl --user enable onedrive
systemctl --user start onedrive
For headless servers, you may need to use a service manager like systemd
in user mode, or set up a cron
job to run onedrive --synchronize
periodically.
Configuration
Edit the default config at:
~/.config/onedrive/config
Options include setting sync direction, skipping certain directories, or downloading files on-demand.
Can You Use OneDrive on a Linux Server? (F.A.Q)
Can I use OneDrive on a headless Linux server?
Yes, with the CLI tool onedrive
, you can run it via systemd or cron without needing a GUI.
Is the OneDrive Linux client secure?
Yes, the open-source onedrive
client uses OAuth2 for secure authentication and TLS for data transfer.
Can I sync specific folders only?
Absolutely. Use the sync_dir
option in the config file or use command-line flags like --single-directory
.
Does OneDrive on Linux support two-way sync?
Yes, the client supports full two-way synchronization between your server and OneDrive.