How to sync Microsoft OneDrive with Linux

Microsoft OneDrive is a cloud data storage service similar to IDrive, Google Drive, Dropbox, pCloud, and so on. There is no official Linux client provided by Mircosoft.

As much as we love open source, we can’t deny the fact that proprietary software and services still exist, and are used by a significant group of people. And thanks to the FOSS developers out there who make services and apps for our beloved Linux system, bridging the gap between the FOSS and proprietary software users, to make the life easier.

So in this article, we are going to show how to sync Microsoft OneDrive data to your Linux system. For those not aware of Microsoft OneDrive, it is a cloud data storage service similar to IDrive, Google Drive, Dropbox, pCloud, and so on. Microsoft provides desktop apps for Windows, Android, Mac OS, and iOS platforms. Unfortunately, Linux is left out, but no worries there is OneDrive Free Client for Linux.

OneDrive Free Client Features

It is an open-source client that comes with powerful features such as state caching, Real-Time file monitoring with Inotify, Resumable uploads, support for OneDrive for Business (part of Office 365), and Shared folders. This is a command-line tool and hence it has no GUI.

Sync OneDrive with Linux

We are going to show the installation and configuration of OneDrive Free Client. It is a CLI based program that can be configured to sync the OneDrive data on every boot-up of your system. It is easy to set up and doesn’t need much maintenance or tweaking after installation.



OneDrive has some dependencies that can be installed in the following ways.

For Ubuntu/Linux Mint and its derivatives:

sudo apt install libcurl4-openssl-dev git
sudo apt install libsqlite3-dev
sudo wget -O /etc/apt/sources.list.d/d-apt.list

This command just added a repository, so you will have to tell your system to trust it. For that, use the following commands:

sudo nano /etc/apt/sources.list.d/d-apt.list

Now after the “deb” part of the first line, insert this:


The file will look like this:

Adding repository permission.
Adding repository permission

Leave spaces on both sides, and save it by pressing CTRL + X, then type ‘y’ and press Enter.

Now continue with this:

sudo apt-get update && sudo apt-get -y install  d-apt-keyring
sudo apt-get update && sudo apt-get install dmd-compiler dub

For Arch Linux and derivatives:

sudo pacman -S curl sqlite dlang git

For Fedora:

sudo yum install libcurl-devel git
sudo yum install sqlite-devel
curl -fsS | bash -s dmd

Downloading and compiling the program

Now that we are done with the dependencies, we can go ahead and install the program.

First, we download the files:

git clone

Then compile and install it:

cd oneDrive
sudo make install
OneDrive installation.
OneDrive installation on Linux Mint


After the program launch, it will download all of your files to a directory named OneDrive, which is created in your home directory. This section is only for those who want to change the destination directory or add exceptions to the files that get synced.

Enter the following commands to create a configuration file for OneDrive:

mkdir -p ~/.config/onedrive
cp ~/onedrive/config ~/.config/onedrive/config

And now edit it:

nano .config/onedrive/config

It will look something like this:

OneDrive configuration file.
OneDrive configuration file

if you want to change the destination directory, you can change it here. As shown, it is a directory named OneDrive in your home directory.

Now to skip any specific type of files, you have to add its extension. For example, if I did not want any Python files to be synced, I shall add the .py extension to the line skip_file. It is done as follows:

OD Config file 2
Not allowing Python files to sync

So add a pipe symbol (|), put an asterisk (*), and write the extension of the file you want to reject.

Running the program

Finally comes the stage when you run the program. Even though this looks like the main part of the whole process, it is a one-time requirement.

Run in the Terminal:


You will see a link on your Terminal:

Launching OneDrive
Launching OneDrive

Copy the link, and open it in your browser. When you open it, the Microsoft Account login screen will appear. Sign in, and click on ‘Yes’ when the prompt asks if you want to let the application access your data.

Microsoft permission prompt.
Microsoft permission prompt

The sign in will end in a blank window. When the blank window appears, copy the link of that page, and paste it back into the Terminal. Press Enter and the download of your files will begin.

Hence, your OneDrive files are synced with your Linux system.


If you want to keep your system up-to-date with your drive, you might want to start this program at login itself. To do that, enter these commands:

sudo systemctl --user enable onedrive
sudo systemctl --user start onedrive

OneDrive Client Uninstallation

For some reason, if you think the tool is not for you, here are the uninstallation commands that should be entered in the Terminal.

sudo make uninstall
rm -rf .config/onedrive


All your OneDrive files are synced to the OneDrive directory on your Linux system. OneDrive lets you make even more configurations to your synchronized directory. You can check them here. Let us know what you think about this program in the comments. Cheers!


Related Articles


  1. Thanks for the guide; however, the command:
    sudo systemctl –user enable onedrive
    results in:
    Failed to connect to bus: No such file or directory
    Thus, no automatic syncing after the first sync.

  2. I have the same problem as Kim Ludvigen, I get the sam directory does not exist reply. However, if I look in my personal folder, There is a directory OneDrive created with some test files included.

  3. Problem at git ans cd onedrive:
    sceen text:

    W: GPG error: d-apt Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY EBCF975E5BA24D5E
    E: The repository ‘ d-apt Release’ is not signed.
    N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    david@david-TP500LN:~$ git clone
    fatal: destination path ‘onedrive’ already exists and is not an empty directory.

  4. Hi,
    I did get the onedrive to sync, however, these are not on Linux mint 19

    sudo systemctl –user enable onedrive
    sudo systemctl –user start onedrive

    So I have tried Startup applications instead.

  5. Hi,
    during compilation I get the following error message:

    echo v1.1.3 >version
    dmd -g -ofonedrive -O -L-lcurl -L-lsqlite3 -L-ldl -J. src/config.d src/itemdb.d src/log.d src/main.d src/monitor.d src/onedrive.d src/qxor.d src/selective.d src/sqlite.d src/sync.d src/upload.d src/util.d
    src/sqlite.d(142): Deprecation: foreach: loop index implicitly converted from size_t to int
    sed “s|@PREFIX@|/usr/local|g” > onedrive.service

  6. This isn’t a real replacement. No GUI, and I hope you don’t have more on your OneDrive than you do on your PC in terms of space, or guess what? This will fill your HDD.

  7. I run into a problem in the Downloading and compiling the program step, specifically the “make” command results in the following

    make: *** No targets specified and no makefile found. Stop.

    • Got that to work through instructions on the github page.

      Still having issues with:
      sudo systemctl –user enable onedrive
      sudo systemctl –user start onedrive

      I get the following Error
      Failed to connect to bus: No such file or directory

  8. When running this:
    tim@tim-X540SA:~/onedrive$ nano .config/onedrive/config

    I get this message:
    [ Directory ‘.config/onedrive’ does not exist ]
    and an otherwise blank screen

    I’m a newbie and now lost. Please help.
    Thank you in advance.

  9. When running this:
    tim@tim-X540SA:~/onedrive$ nano .config/onedrive/config

    I get this message:
    [ Directory ‘.config/onedrive’ does not exist ]
    and an otherwise blank screen

    I’m a newbie and now lost. Please help.
    Thank you in advance.

    System: Host: tim-X540SA Kernel: 5.0.0-37-generic x86_64 bits: 64 compiler: gcc v: 7.4.0
    Desktop: MATE 1.22.2 wm: marco dm: LightDM Distro: Linux Mint 19.3 Tricia
    base: Ubuntu 18.04 bionic
    Machine: Type: Laptop System: ASUSTeK product: X540SA v: 1.0 serial:
    Mobo: ASUSTeK model: X540SA v: 1.0 serial: UEFI: American Megatrends
    v: X540SA.210 date: 04/13/2016
    Battery: ID-1: BAT0 charge: 28.0 Wh condition: 28.2/33.2 Wh (85%) volts: 11.2/11.2
    model: ASUSTeK X550A26 serial: status: Unknown
    CPU: Topology: Quad Core model: Intel Pentium N3700 bits: 64 type: MCP arch: Airmont rev: 3
    L2 cache: 1024 KiB
    flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 12800
    Speed: 1649 MHz min/max: 480/2400 MHz Core speeds (MHz): 1: 1109 2: 1204 3: 2400
    4: 2400
    Graphics: Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics
    vendor: ASUSTeK driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:22b1
    Display: x11 server: X.Org 1.19.6 driver: modesetting unloaded: fbdev,vesa
    compositor: marco resolution: 1366×768~60Hz, 1600×900~60Hz
    OpenGL: renderer: Mesa DRI Intel HD Graphics 405 (Braswell) v: 4.5 Mesa 19.0.8
    compat-v: 3.0 direct render: Yes
    Audio: Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series High
    Definition Audio
    vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1b.0 chip ID: 8086:2284
    Sound Server: ALSA v: k5.0.0-37-generic
    Network: Device-1: Realtek RTL810xE PCI Express Fast Ethernet vendor: ASUSTeK driver: r8169
    v: kernel port: e000 bus ID: 02:00.0 chip ID: 10ec:8136
    IF: enp2s0 state: down mac:
    Device-2: Qualcomm Atheros AR9485 Wireless Network Adapter vendor: AzureWave AW-NE186H
    driver: ath9k v: kernel port: e000 bus ID: 03:00.0 chip ID: 168c:0032
    IF: wlp3s0 state: up mac:
    Drives: Local Storage: total: 465.76 GiB used: 60.17 GiB (12.9%)
    ID-1: /dev/sda vendor: Toshiba model: MQ01ABF050 size: 465.76 GiB speed: 6.0 Gb/s
    Partition: ID-1: / size: 456.96 GiB used: 60.17 GiB (13.2%) fs: ext4 dev: /dev/sda2
    USB: Hub: 1-0:1 info: Full speed (or root) Hub ports: 7 rev: 2.0 chip ID: 1d6b:0002
    Device-1: 1-1:2 info: Logitech Unifying Receiver type: Mouse,HID
    driver: hid-generic,usbhid rev: 2.0 chip ID: 046d:c52f
    Device-2: 1-2:4 info: Logitech Classic Keyboard 200 type: Keyboard
    driver: hid-generic,usbhid rev: 1.1 chip ID: 046d:c315
    Device-3: 1-4:3 info: Realtek type: Video driver: uvcvideo rev: 2.0 chip ID: 0bda:57de
    Hub: 2-0:1 info: Full speed (or root) Hub ports: 6 rev: 3.0 chip ID: 1d6b:0003
    Sensors: System Temperatures: cpu: 6280.0 C mobo: N/A
    Fan Speeds (RPM): cpu: 3400
    Repos: No active apt repos in: /etc/apt/sources.list
    Active apt repos in: /etc/apt/sources.list.d/d-apt.list
    1: deb [trusted=yes] https: // d-apt main #APT repository for D (NetCologne – SourceForge)
    Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http: // tricia main upstream import backport #id:linuxmint_main
    2: deb http: // bionic main restricted universe multiverse
    3: deb http: // bionic-updates main restricted universe multiverse
    4: deb http: // bionic-backports main restricted universe multiverse
    5: deb http: // bionic-security main restricted universe multiverse
    6: deb http: // bionic partner
    Info: Processes: 223 Uptime: 3h 49m Memory: 3.76 GiB used: 2.64 GiB (70.3%) Init: systemd
    v: 237 runlevel: 5 Compilers: gcc: 7.4.0 alt: 7 Client: Unknown python3.6 client
    inxi: 3.0.32

  10. Nevermind, I found the config file in the folder and it looked correct per your image, so I was then able to continue the process with no other issues. Thank you for your time.

  11. Any way to sync two different Onedrives? I have a Personal Onedrive account and a Business Onedrive account and I would like to sync both but not co-mingle the directories and files.

  12. The details in this article are incorrect as it points to an defunct code repository. The ‘skilion’ OneDrive client ( ) appears to have been abandoned and contains many defects that put you at risk of data loss and corruption if you use it. The original author is totally uncontactable despite numerous efforts by myself and others.

    If you wish to use the latest code which contains numerous fixes and enhancements you need to clone & build from this repo:

    If you wish to use the latest code which contains numerous fixes and enhancements you need to clone & build from that repo as well.

    Major differences / Enhancements:
    – Existing bugs with skilion client fixed
    – File upload / download validation to ensure data integrity
    – SharePoint / Office 365 Shared Libraries added
    – Desktop notifications via libnotify
    – Dry-run capability to test configuration changes
    – Prevent major OneDrive accidental data deletion after configuration change

    Further details can be found here:

  13. Works well for me, but the initial make command froze my system! working OK now, and removed the account elevation to enable and start onedrive. Question, do you have to restart to force synch with Onedrive?

    • Yes, your system will be synced with OneDrive on every reboot. Otherwise manually restarting the service should also do the trick. sudo systemctl –user restart onedrive

  14. Hello.
    Works fine on Fedora.
    Did 1 modification on src/qxord.d
    Before: import std.digest.digest;
    After: import std.digest;

    To activate onedrive service, i used these commands:
    XDG_RUNTIME_DIR=/run/user/$UID systemctl –user enable onedrive
    XDG_RUNTIME_DIR=/run/user/$UID systemctl –user start onedrive

    you did a great job, thanks for all

  15. Works good here!

    Only one question::
    Is it normal for the installation / configuration to have created 2 folders, one called “OneDrive” (which contains my files) and the other called “onedrive” (where it appears to have the configuration files)?

    Thank you all

  16. Installation and configuration on my Linux Mint 18.1 machine seemed to go smoothly, however when I ran it, I got the following output:

    graham@graham-minidesktop ~ $ onedrive-d start
    Traceback (most recent call last):
    File “/usr/local/bin/onedrive-d”, line 33, in
    sys.exit(load_entry_point(‘onedrive-d==1.1.0.dev0’, ‘console_scripts’, ‘onedrive-d’)())
    File “/usr/local/lib/python3.5/dist-packages/pkg_resources/”, line 473, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
    File “/usr/local/lib/python3.5/dist-packages/pkg_resources/”, line 2843, in load_entry_point
    return ep.load()
    File “/usr/local/lib/python3.5/dist-packages/pkg_resources/”, line 2447, in load
    return self.resolve()
    File “/usr/local/lib/python3.5/dist-packages/pkg_resources/”, line 2453, in resolve
    module = __import__(self.module_name, fromlist=[‘__name__’], level=0)
    File “”, line 969, in _find_and_load
    File “”, line 958, in _find_and_load_unlocked
    File “”, line 664, in _load_unlocked
    File “”, line 634, in _load_backward_compatible
    File “/usr/local/lib/python3.5/dist-packages/onedrive_d-1.1.0.dev0-py3.5.egg/onedrive_d/”, line 8, in
    File “/usr/local/lib/python3.5/dist-packages/click-8.0.0a1-py3.5.egg/click/”, line 7, in
    from .core import Argument
    File “/usr/local/lib/python3.5/dist-packages/click-8.0.0a1-py3.5.egg/click/”, line 91
    f”{hint}. Command {!r} is set to chain and”
    SyntaxError: invalid syntax

    I don’t know Python so this doesn’t mean much to me.

    Anyone know what I’m doing wrong?

  17. How can I completely remove this client and it’s dependencies so I can start over with the install process? The uninstall commands didn’t do anything for me..

  18. After I inputted the url of the BLANK web page I get the following – What have i done wrong ?

    onedrive.OneDriveException@src/onedrive.d(874): HTTP request returned status code 400 (Bad Request)
    “correlation_id”: “7e4afaf0-3892-4264-8865-ca771f997132”,
    “error”: “invalid_grant”,
    “error_codes”: [
    “error_description”: “AADSTS70000: The provided value for the ‘code’ parameter is not valid.\r\nTrace ID: 24060108-4313-4713-8932-4a32dd710200\r\nCorrelation ID: 7e4afaf0-3892-4264-8865-ca771f997132\r\nTimestamp: 2021-05-20 23:53:16Z”,
    “error_uri”: “https:\/\/\/error?code=70000”,
    “timestamp”: “2021-05-20 23:53:16Z”,
    “trace_id”: “24060108-4313-4713-8932-4a32dd710200”
    ??:? [0x55bc4a9499d9]
    ??:? [0x55bc4a948cb5]
    ??:? [0x55bc4a949b65]
    ??:? [0x55bc4a947f58]
    ??:? [0x55bc4a9478c5]
    ??:? [0x55bc4a9557a8]
    ??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll() [0x7fe751bef9db]
    ??:? _d_run_main2 [0x7fe751bef7ee]
    ??:? _d_run_main [0x7fe751bef65d]
    ??:? __libc_start_main [0x7fe7517db0b2]
    ??:? [0x55bc4a9205ed]

  19. How can I choose to sync only particular files and folders? I don’t want to sync my whole OneDrive data, it’s too much.

  20. What is the solution for this : “correlation_id”: “51340f1d-120a-4650-b670-5e827e431367”,
    “error”: “invalid_grant”,
    “error_codes”: [
    “error_description”: “AADSTS70000: The provided value for the ‘code’ parameter is not valid.\r\nTrace ID: 241f1e21-8c44-4e33-a4f0-c912130f9402\r\nCorrelation ID: 51340f1d-120a-4650-b670-5e827e431367\r\nTimestamp: 2021-10-27 19:05:40Z”,
    “error_uri”: “https:\/\/\/error?code=70000”,
    “timestamp”: “2021-10-27 19:05:40Z”,
    “trace_id”: “241f1e21-8c44-4e33-a4f0-c912130f9402”
    ??:? [0x555e4a72e9d9]
    ??:? [0x555e4a72dcb5]
    ??:? [0x555e4a72eb65]
    ??:? [0x555e4a72cf58]
    ??:? [0x555e4a72c8c5]
    ??:? [0x555e4a73a7a8]
    ??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll() [0x7f2e24d099db]
    ??:? _d_run_main2 [0x7f2e24d097ee]
    ??:? _d_run_main [0x7f2e24d0965d]
    ??:? __libc_start_main [0x7f2e248f50b2]
    ??:? [0x555e4a7055ed]

    THX for help


Please enter your comment!
Please enter your name here


More Articles Like This