How to Use Microsoft OneDrive in Linux With Rclone Open-Source Tool [For Intermediate to Expert Users]

A step-by-step tutorial showing how to use the rclone command line tool to synchronize OneDrive in Linux.
Warp Terminal

Microsoft’s own Cloud storage service, OneDrive, gives any Microsoft account holder 5 GB of free storage.

The one major problem is that Microsoft does not provide a desktop client for Linux, unlike other cloud services like Dropbox and Mega.

This means that you’ll have to resort to using a web browser for accessing your files in OneDrive, which is not very convenient.

There is a hassle-free, GUI application that lets you use OneDrive on Linux easily. It’s called Insync but it is a premium software and not everyone wants to use it.

If you are not afraid of the Linux terminal, let me show you a command line tool rclone that you can use for synchronizing Microsoft OneDrive in Linux.

What is rclone?

Rclone is an open source command line tool that enables you to synchronize a local Linux directory with various cloud storage services. With rclone, you can backup files to cloud storage, restore files from cloud storage, mirror cloud data, migrate data between cloud services, use multiple cloud storage as disk.

You can use it with Google Drive, OneDrive, Nextcloud, Amazon S3 and over 40 such cloud services.

Rclone is an extensive command line tool and using it could be confusing with so many options. This is why I wrote this tutorial to show you how to use rclone with Microsoft OneDrive.

There is a separate tool called Rclone Browser that makes using rclone easier by providing a GUI.
Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically
Brief: Rclone Browser is an effective GUI program that makes it easy to manage and sync data on cloud storage using Rclone. Here, we take a look at what it offers and how it works. If you want to use One Drive or Google Drive on Linux natively and effortlessly,

Sync Microsoft OneDrive in Linux with rclone

Using rclone in Linux is not that complicated but requires some patience and familiarity with the Linux terminal. You need to tweak the configuration a little to make it work. Let’s see how to do that.

Step 1: Install Rclone

I am using Ubuntu 20.04 in this tutorial but you should be able to follow this tutorial in pretty much any Linux distribution. Just the rclone installation instruction could be different but the rest of steps remain the same.

In Debian/Ubuntu-based distributions, use:

sudo apt install rclone

For Arch-based distributions, use:

sudo pacman -S rclone

For other distributions, please use your distribution’s package manager.

Step 2: Adding new remote

Once you have installed rclone successfully, you need to configure rclone. Enter the following command in the terminal:

rclone config

If it’s your first time using rclone, you must add a new remote to rclone. Select ‘n‘ to add a new remote.

Configuring Rclone
Configuring Rclone

Now you have to enter the name of the remote. You can enter any name here that matches the cloud service so that it is easy to identify. I am using ‘onedrive‘.

Configuring Rclone
Configuring Rclone

Step 3: Select the cloud service you want to sync with rclone

After entering the name and hitting enter, you will see a list of cloud services like Google cloud storage, Box, One Drive and others.

You have to enter the number of the service you want to use. In this case, it’s ‘One Drive’. Make sure you enter the correct number.

Selecting Cloud Service
Selecting Cloud Service

As you don’t need to enter client ID or secret ID hit Enter twice.

Next enter ‘N’ for selecting no for advanced configuration. Of course, if you want to configure something very specific, you can go ahead with Y.

Configuring Onedrive with rclone in Linux
Configuring OneDrive

When you’re asked for ‘Use auto config’, press Y.

Step 4: Log in to OneDrive account

When you enter ‘y’ and hit enter, your default browser will open and here you have to log into your Microsoft account. And if it asks for permission click on ‘yes’.

One Drive Logging In
One Drive Logging In

Step 5: Enter account type

Now you have to select account type. For most of the users, it will be the first one, ‘One drive Personal or business’. I believe it is personal, so go with 1.

Configuring Onedrive with rclone

After that, you will get a list of ‘Drives’ associated with your account. So, for the most part, you need to select ‘0’ to select your drive and enter ‘Y‘ for yes in next step.

Configuring Onedrive

It will ask one last time if this configuration is okay. Hit ‘Y’ if it is.

Configuring One Drive

And then enter ‘q’ to exit the Rclone configuration menu.

Exiting Rclone Configuration

Step 6: Mounting OneDrive in the file manager

Create a folder in your home directory where you will mount OneDrive. I will name the folder “OneDrive”. You can name it whatever you want, but please make sure you change the name to yours in the commands.

Create a new folder with mkdir command in your home directory or wherever you want:

mkdir ~/OneDrive

Now you have to use the following command:

rclone --vfs-cache-mode writes mount "one drive":  ~/OneDrive

In the above command, “one drive” is the name of the “remote”, so you should use the correct name there if yours is different. You can check the name of the “remote” in step 2 of this tutorial.

Mounting One Drive in Linux with rclone
Mounting One Drive

This command will mount one drive in the given location and will continue to run in the terminal. When you stop the process with,ctrl + c the one drive will be unmounted.

To mount one drive on startup, follow the next step below.

In testing, it has been found that the it doesn’t show automatically as a folder in the side panel in dolphin. However, the onedrive is successfully mounted on the directory ~/onedrive as it should be.

Step 6: Mount One Drive on startup

Every Linux distribution gives some way to manage startup applications. I am using Ubuntu’s Startup Application Preferences tool here.

Open "Startup Applications". And click on "Add". Now, in the command field, enter the following:

sh -c "rclone --vfs-cache-mode writes mount \"one drive\": ~/OneDrive"
Mounting Onedrive On Startup in Linux
Mounting OneDrive On Startup

That’s it. Now, you can easily use OneDrive on Linux without any hiccups.

This goes without saying that the system should be connected to the internet at startup; otherwise the startup script will throw errors. Sometimes the folder is inaccessible or doesn't list contents of one drive from dolphin file manager, but can be accessed through the command line.

Worth the effort?

As you can see, using OneDrive in Linux with rclone takes some effort. You can use pretty much the same steps to access Google Drive on Linux with rsync.

If you want an easy way out, get a GUI tool like experience and use OneDrive natively in Linux with Insync. It's a closed-source, paid tool but saves you the trouble (and joy) of configuring things manually.

It would have been a lot better if Microsoft provided a native client for Linux. But that wouldn't be very Microsoft-like after all.

This is the reason why I prefer Mega, which provides up to 20 GB of cloud storage for free.

MEGA provides free cloud storage with convenient and powerful always-on privacy. Claim your free 20GB now

Partner Link

I hope you find this tutorial helpful in getting OneDrive on Linux. If you have any questions or suggestions, we’ll be happy to help you out.

Tutorial submitted by Sumeet, a computer engineer, FOSS lover, and lower-level computing enthusiast who believes in helping others and spreading knowledge.
The tutorial was last verified by Gurbir Singh on Sep 21, 2023. However, if you notice technical inaccuracy or outdated information, please let us know.
About the author


Written by a community member, a reader who is not part of the It's FOSS writing team. The views and opinions expressed are those of the authors and do not necessarily reflect that of It's FOSS.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world


Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.