This guide walks you through setting up Microsoft OneDrive on Linux using rclone.
Prerequisites
- rclone installed on your Linux system
- A Microsoft OneDrive account
- A web browser for authentication
Installation
sudo pacman -S rclone
Configuration Steps
1. Start rclone Configuration
rclone config
2. Create a New Remote
When prompted, select:
nfor New remote- Enter a name for your remote (e.g.,
OneDrive)
3. Select Storage Type
- Choose option
38for Microsoft OneDrive - Or type
onedrive
4. OAuth Configuration
Leave the following blank (press Enter):
client_idclient_secret
5. Choose Region
Select your region:
1for Microsoft Cloud Global (most common)2for US Government3for Germany4for China
6. Authentication
When asked “Use web browser to automatically authenticate?”:
- Select
y(Yes) - Your browser will open automatically
- If it doesn’t, copy and paste the provided URL
- Log in to your Microsoft account and authorize rclone
7. Select Drive Type
Choose your connection type:
1for OneDrive Personal or Business (most common)2for Root Sharepoint site- Other options for advanced configurations
8. Select Drive
If you have multiple drives, select the appropriate one (usually option 1 for your main OneDrive).
9. Confirm Configuration
- Review the configuration
- Select
yto keep the remote - Select
qto quit config
Mount Script
Create a script to easily mount your OneDrive:
#!/usr/bin/bash
# ___ ____ _
# / _ \ _ __ ___| _ \ _ __(_)_ _____
# | | | | '_ \ / _ \ | | | '__| \ \ / / _ \
# | |_| | | | | __/ |_| | | | |\ V / __/
# \___/|_| |_|\___|____/|_| |_| \_/ \___|
#
rclone --vfs-cache-mode writes mount OneDrive: ~/OneDrive &
notify-send "OneDrive connected" "Microsoft OneDrive successfully mounted"
Save this as onedrive.sh and make it executable:
chmod +x onedrive.sh
Usage
Mount OneDrive
Run your script:
./onedrive.sh
Or manually:
rclone --vfs-cache-mode writes mount OneDrive: ~/OneDrive
Notes
- The configuration file is stored at
~/.config/rclone/rclone.conf - Make sure the mount point directory (
~/OneDrive) exists before mounting - The
--vfs-cache-mode writesflag improves performance for write operations - Access tokens are automatically refreshed by rclone