Post

Setting up Microsoft OneDrive on Linux

There is not an official Microsoft OneDrive client. But there are a few options out there. Here is an easy way to set up one of those options.

Setting up Microsoft OneDrive on Linux

Since I am in a heavily dominated Microsoft environment, I decided to run Ubuntu LTS. So the following instructions will probably work with any Debian based distro. Due to the simplicity, you can probably adapt the instructions below for almost any other distro.

There are a few options out there for setting up OneDrive on Linux, but there is no official Microsoft client. I have chosen to go with the onedrive package that comes in the official Ubuntu (and Debian) apt repos. It may not be the most straight forward to setup but it is easy.

Installation

Start by installing the package.

1
2
# Install the onedrive package
sudo apt install onedrive

Authentication

After the installation, run onedrive from the command line and follow the prompts for connecting to your account.

1
2
# Just type in `onedrive` in to the command line.
onedrive

A URL will be displayed on your screen. Open that URL in a web browser. Once it loads, it will ask you to log in and accept the application permissions. After accepting, a blank page will load. That is expected. Copy the URL from the address bar of the web browser and paste it in to the command line. Right now, the command should be prompting you to “Enter the response uri”.

Configuration

This is optional. If you want to change any configs, copy the default config and then make your desired edits.

1
2
# Get the default config and save it to your home directory.
sudo cp /usr/share/doc/onedrive/config ~/.config/onedrive/

Set up automatic syncing

At this point onedrive will work. But it will only sync when you manually run it. We need to tell onedrive to continually run as a system process. If you have a lot of files, you may want to run it independently the first time (i.e. onedrive --synchronize).

1
2
3
4
# Add onedrive as a system process.
# Note: NOT using sudo so it only applies to the current user.
systemctl enable --user onedrive # Add it.
systemctl start --user onedrive # Start it.

You should now have a directory at ~/OneDrive/. Syncing will automatically happen between OneDrive and this directory. Enjoy!

This work by Jason Raveling is licensed under CC BY-ND 4.0 .