OneDrive File Synchronization on Linux
In this post I’m going to show you how to setup OneDrive file synchronization on your linux machine.
Install a OneDrive Client
Unfortunately there is no official OneDrive client provided by Microsoft, so we are going to use an open source alternative.
On Fedora, we can install the client with the following command:
sudo dnf install onedrive
If you are using Ubuntu or any other Debian based distribution, you can simply replace dnf
with apt
.
After the installation we need to authenticate the OneDrive client. For this we execute the following command:
onedrive
This will print an URL into the console window which we need to open in the browser of our choice. Next we need to login and authorize the client to access OneDrive. Once we have done that, we will be redirected to an empty page. This is normal, as we need to copy the URL of the page and paste it into the console window and press enter. After that the OneDrive client should be authenticated.
Enable selective Synchronization
If you want to synchronize all the files in your OneDrive, you can skip this section and start the clients systemd service, which will start the synchronization process. But if you want to enable selective synchronization and choose which files are synchronized, you need to create a file called sync_list
inside the folder ~/.config/onedrive
. The file should contain a list of filename patterns that will be synchronized.
Start systemd Service
To start the synchronization we have to enable and start the systemd service of the OneDrive client with the following commands:
systemctl --user enable onedrive
systemctl --user start onedrive
We can check the status of the service with:
systemctl status --user onedrive