sodcalculator

10 Tech How-To

How to Access & Use OneDrive on Linux

Guide 10-23963 · Updated · Step by step

OneDrive is Microsoft’s cloud storage service, and while there’s no official Linux client, you can still sync and manage your files using third-party tools. This guide covers the most reliable methods—using the rclone command-line tool and the OneDrive Client for Linux (a community-developed sync client)—so you can access your files from the desktop or terminal. You’ll need a OneDrive account (personal or work/school) and a Linux system with internet access.

What You’ll Need

  • A OneDrive account (free or Microsoft 365)
  • A Linux distribution (Ubuntu, Debian, Fedora, Arch, etc.)
  • Terminal access (Ctrl+Alt+T on most distros)
  • For the OneDrive Client: build-essential, libcurl4-openssl-dev, libsqlite3-dev, pkg-config, and git (install via your package manager)
  • For rclone: just the rclone binary (install via script or package manager)

Step-by-Step

Method 1: Using rclone (Recommended for Most Users)

  1. Install rclone – Open a terminal and run the official install script: curl https://rclone.org/install.sh | sudo bash. Alternatively, use your package manager (e.g., sudo apt install rclone on Debian/Ubuntu).
  2. Configure OneDrive remote – Type rclone config and press n to create a new remote. Name it (e.g., onedrive). Choose onedrive from the storage type list (type onedrive and press Enter).
  3. Authenticate – When prompted for a client ID and secret, leave them blank (press Enter) to use rclone’s built-in defaults. Choose your OneDrive account type (personal, business, or document library). For personal accounts, select onedrive (option 1).
  4. Complete the OAuth flow – rclone will give you a URL to open in your browser. Log in with your Microsoft account and authorize rclone. Copy the verification code and paste it back into the terminal.
  5. Select your drive – After authentication, rclone will list available drives. Choose the one that says OneDrive Personal or your work/school drive. Confirm the configuration and exit.
  6. Test the connection – Run rclone lsd onedrive: to list folders. If you see your files, you’re connected.
  7. Sync files manually – To copy a local folder to OneDrive: rclone copy /home/username/Documents onedrive:Documents. To download: rclone copy onedrive:Documents /home/username/Documents.
  8. Set up auto-sync (optional) – Use rclone sync with --dry-run first to test, then schedule it with cron or systemd timer. For example, add a cron job: crontab -e and add */10 * * * * rclone sync /home/username/Documents onedrive:Documents to sync every 10 minutes.

Method 2: Using OneDrive Client for Linux (Full Sync)

  1. Install dependencies – On Debian/Ubuntu, run: sudo apt install build-essential libcurl4-openssl-dev libsqlite3-dev pkg-config git. On Fedora: sudo dnf install gcc-c++ libcurl-devel sqlite-devel pkgconfig git. On Arch: sudo pacman -S base-devel curl sqlite pkg-config git.
  2. Clone the repository – git clone https://github.com/abraunegg/onedrive.git and cd onedrive.
  3. Compile and install – Run make then sudo make install. This installs the onedrive binary.
  4. First run and authorization – Run onedrive in the terminal. It will show a URL. Open it in a browser, log in, and paste the resulting code back into the terminal. This creates a config file in ~/.config/onedrive/.
  5. Perform a sync – Run onedrive --synchronize to sync all files to ~/OneDrive. The first sync may take a while depending on your library size.
  6. Enable continuous monitoring (optional) – Run onedrive --monitor to keep syncing in real-time. To run it in the background, use nohup onedrive --monitor & or set up a systemd service (see the project’s wiki).
  7. Sync only specific folders – Edit ~/.config/onedrive/sync_list and add folder names (one per line) to limit sync. Then run onedrive --synchronize again.

Common Mistakes

  • Using the wrong account type – When configuring rclone, choosing “business” for a personal account will cause errors. Double-check the option.
  • Not using the correct remote path – In rclone, paths are case-sensitive. onedrive:Documents is not the same as onedrive:documents.
  • Running the OneDrive client without a config – The client requires a one-time authorization; skipping it leads to “Cannot open config file” errors.
  • Forgetting to install dependencies – The OneDrive client won’t compile without the required libraries. Ensure all packages are installed.
  • Using rclone sync without --dry-run first – sync deletes files in the destination that aren’t in the source. Always test with --dry-run to avoid accidental data loss.

Tips

  • Use rclone for occasional access – If you only need to upload/download files occasionally, rclone is simpler and doesn’t require a full sync.
  • Encrypt your remote (rclone) – You can add an encryption layer to your OneDrive remote to protect sensitive files before uploading.
  • Limit bandwidth – In rclone, use --bwlimit 10M to cap upload/download speed and avoid saturating your connection.
  • Keep the OneDrive client updated – The community client is actively maintained; pull the latest changes with git pull and rebuild regularly.
  • Use a systemd service for the OneDrive client – The project’s wiki provides a service file that auto-starts monitoring on boot, which is more reliable than a background process.

Troubleshooting

  • Authentication fails in rclone – Clear your browser cookies and try again. Also ensure your system time is correct (run sudo ntpdate ntp.ubuntu.com or use timedatectl).
  • “Failed to create file system” in rclone – This usually means the remote name is wrong or the drive wasn’t selected. Run rclone config and redo the setup.
  • OneDrive client compile errors – Make sure all dependencies are installed. If you’re on a newer distro, you may need to install libnotify-dev as well.
  • Sync doesn’t start – Check the config file at ~/.config/onedrive/config; ensure the sync_dir path exists and is writable.
  • Files not appearing after sync – The client may be skipping files due to sync_list filters. Check sync_list and remove any entries that shouldn’t be excluded.
  • High CPU usage – If the OneDrive client uses 100% CPU, it’s often due to a large number of files. Try running onedrive --resync to rebuild the local database.

Frequently Asked Questions

Is there an official OneDrive app for Linux?

No, Microsoft does not provide an official desktop client for Linux. However, you can use OneDrive through the web interface or third-party tools like rclone and the OneDrive Client for Linux.

Can I use OneDrive with GNOME Files or Nautilus?

Yes, you can mount OneDrive as a network folder using rclone’s mount feature: rclone mount onedrive: ~/OneDrive. This integrates with your file manager, though it’s not as seamless as the Windows client.

Does the OneDrive Client for Linux support work/school accounts?

Yes, the client supports personal, business, and education accounts. During setup, you’ll be prompted to choose the account type.

How do I stop syncing a folder?

In the OneDrive Client, edit the sync_list file and remove the folder name, then run onedrive --synchronize. For rclone, simply don’t include that folder in your sync command.

Can I access OneDrive files from the terminal without syncing?

Yes, rclone allows you to list, download, and upload files directly without a full sync. For example, rclone cat onedrive:file.txt prints the file content.

Is it safe to use these tools with my Microsoft account?

Both rclone and the OneDrive Client use official OAuth authentication, so your password is never stored. You can revoke access at any time from your Microsoft account security settings.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →