How to sync Microsoft OneDrive on Linux

OneDrive (previously known as SkyDrive) is a popular cloud storage offering from Microsoft. Currently OneDrive offers 7GB free storage for every new signup. As you can imagine, OneDrive is well integrated with other Microsoft software products. Microsoft also offers a standalone OneDrive client which automatically backs up pictures and videos taken by a camera to OneDrive storage. But guess what. This client is available for all major PC/mobile platforms except Linux. "OneDrive on any device, any time"? Well, it is not there, yet.

Don't get disappointed. The open-source community already has already come up with a solution for you. onedrive-d written by a Boilermaker in Lafayette can get the job done. Running as a monitoring daemon, onedrive-d can automatic sync a local folder with OneDrive cloud storage.

In this tutorial, I will describe how to sync Microsoft OneDrive on Linux by using onedrive-d.

Install onedrive-d on Linux

While onedrive-d was originally developed for Ubuntu/Debian, it now supports CentOS/Fedora/RHEL as well.

Installation is as easy as typing the following.

$ git clone https://github.com/xybu92/onedrive-d.git
$ cd onedrive-d
$ ./inst install

First-Time Configuration

After installation, you need to go through one-time configuration which involves granting onedrive-d read/write access to your OneDrive account.

First, create a local folder which will be used to sync against a remote OneDrive account.

$ mkdir ~/onedrive

Then run the following command to start the first-time configuration.

$ onedrive-d

It will pop up a onedrive-d's Settings window as shown below. In "Location" option, choose the local folder you created earlier. In "Authentication" option, you will see "You have not authenticated OneDrive-d yet" message. Now click on "Connect to OneDrive.com" box.

It will pop up a new window asking you to sign in to OneDrive.com.

After logging in to OneDrive.com, you will be asked to grant access to onedrive-d. Choose "Yes".

Coming back to the Settings window, you will see that the previous status has changed to "You have connected to OneDrive.com". Click on "OK" to finish.

Sync a Local Folder with OneDrive

There are two ways to sync a local folder with your OneDrive storage by using onedrive-d.

One way is to sync with OneDrive manually from the command line. That is, whenever you want to sync a local folder against your OneDrive account, simply run:

$ onedrive-d

onedrive-d will then scan the content of both a local folder and a OneDrive account, and make the two in sync. This means either uploading newly added files in a local folder, or downloading newly found files from a remote OneDrive account. If you remove any file from a local folder, the corresponding file will automatically be deleted from a OneDrive account after sync. The same thing will happen in the reverse direction as well.

Once sync is completed, you can kill the foreground-running onedrive-d process by pressing Ctrl+C.

Another way is to run onedrive-d as an always-on daemon which launches automatically upon start. In that case, the background daemon will monitor both the local folder and OneDrive account, to keep them in sync. For that, simply add onedrive-d to the auto-start program list of your desktop.

When onedrive-d daemon is running in the background, you will see OneDrive icon in the desktop status bar as shown below. Whenever sync update is triggered, you will see a desktop notification.

A word of caution: According to the author, onedrive-d is still under active development. It is not meant for any kind of production environment. If you encounter any bug, feel free to file a bug report. Your contribution will be appreciated by the author.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

22 thoughts on “How to sync Microsoft OneDrive on Linux

  1. Really nice article. Currently using it. works like a charm. Was waiting for something like this since so long. Just loving it bro... If any error occurs I'll let u know... :)

  2. I notice that it is hard coded for MS OneDrive. How much trouble would it be to give a choice of cloud providers, such as Google Drive?

  3. Thanks for the heads up on this. Readers might be interested that the developer of the popular DropSync for Android devices recently released another app for OneDrive called OneSync. It's getting good ratings at the app store - makes OneDrive a real cross-platform contender.

  4. Now they need to make this for Windows 8.1 too. It seems like everybody except people using the latest version of Windows can access Skydrive / OneDrive. If you didn't know, you cannot access your Skydrive/Onedrive from Windows 8.1 if you are logging into your computer with a local account as opposed to a Microsoft account.

  5. Wonderful ! Syncronize all my [Sky|One]drive easily.
    an apt-get install git, git command and just after compilation, the configuration windows popup and a wizard wants that I input my OneDrive login.

  6. What about non apt-get and yum systems? What packages are needed? Why does it need a package manager?

  7. Followed the instructions and it works. Hate to have to use Microsoft ever, however I have workmates that use Microsoft Access, (I use SQLite myself with LibraOffice Base and Python to interface with the database ) and I have to be compatible with them. This allows me to also sync any documents I create in the Microsoft 365 with my beloved xubuntu 12.04.4, THANKS A MILLION

    • 1. From the souce directory, you should run the following command
      ./inst uninstall
      2. If you start onedrive-d service when the system boot, run the following commands.
      sudo update-rc.d -f onedrive-d remove
      sudo rm /etc/init.d/onedrive-d
      3. Remove the binary files
      sudo rm /usr/local/bin/onedrive-prefs
      sudo rm /usr/local/bin/onedrive-d
      sudo rm /usr/local/bin/onedrive-cli
      4. Remove the configuration file from your home directory.
      rm -rf ~/.onedrive

  8. Thank you. This seems to athenticate to onedrive.com or login.live.com, where I need to athenticate at portal.office.com I made edits to the daemon.py and prefs.py files, but it continues to athenticate at onedrive.com. I would like to know how I can point athentication to portal.office.com where my Microsoft account resides?

  9. I truly thank you for this. I like running linux but I really like my Windows Phone 8.1 as well. Now I have access to my photos from my phone fairly quickly and with a minimal amount of effort. This is ElementaryOS-Luna. Works flawless.
    Thanks once again.
    Toby Cass

  10. This is really fantastic. I need to be able to switch between Gnome and WIndows and still access the same documents, and I would prefer to use Asus storage, but they don't seem to have a way of running on Ubuntu yet, so OneDrive wins.

    So far, one problem: the auto-start works, but the expected "cloud" icon doesn't appear on the top bar. (If everything else works, then I'm happy, but would like to fix this if possible.)

  11. This works out of the box on Linux Mint (being ubuntu based) with a small change to setup.sh...just add linuxmint to the debian|ubuntu (line 21) so it looks like this:

    case $DISTRIB_ID in
    debian|ubuntu|linuxmint)
    PYGOBJECT_PKG_NAME='python3-gi'
    GIT_PKG_NAME='git'
    INOTIFY_PKG_NAME='inotify-tools'
    SETUPTOOL_PKG_NAME='python3-pip'

  12. Little problem with OneDrive.
    Every system reboot it will do a full sync, create new files and renames the files in my local folder, like this:
    test.txt
    test.txt (OLDER_1409990135.09)
    test.txt (OLDER_1409990135.09) (OLDER_1409990135.09)
    test.txt (OLDER_1409990135.09) (OLDER_1409990135.09) (OLDER_1409990135.09)

    Every reboot it will add a new file.
    Any idea what happens?
    System Linux Mint 17

    • I am likewise not seeing an "inst" command in onedrive-d on Linux Mint. setup.sh, yes. inst no. Following the instructions on the github site, I ran "setup.sh inst" which executes and looks like it worked, but then tells me I should run onedrive-pref to do the setup (no such file or command exists anywhere on my system after install... I searched in case it was off-path), and onedrive-d to start the daemon (the only onedrive-d that exists anywhere is a folder, not a command). What am I missing here? I would love to get this working.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *