1. Home
  2. Linux

How To Access Microsoft OneDrive On Linux

Have you ever wanted to access your Microsoft OneDrive on Linux? If you’re waiting around for Microsoft to make a killer sync client for the Linux platform, don’t hold your breath. They’re not interested in in the Linux platform. Instead, you’ll need to take matters into your own hands.

The best way to access Microsoft OneDrive on Linux is with a program called OneDrive-D. It’s a third-party app that works with OneDrive’s API to bring a decent syncing experience to the Linux desktop. You can access all your files in OneDrive on your Linux PC with this app.

Getting OneDrive-D

Microsoft OneDrive users can sync their files on Linux with the help OneDrive-d. Getting the program working on Linux doesn’t take much. It starts by installing the git package to your Linux distribution. Without this program, getting code from Github isn’t easy. Open a terminal, and enter the following:

Ubuntu

sudo apt install git

Arch Linux

sudo pacman -S git

Fedora

sudo dnf install git

Debian

sudo apt-get install git

OpenSUSE

sudo zypper install git

Other

Git is available on all mainstream Linux distributions, due to the fact that sites like Github are so popular. To get the Git program working on your Linux distribution of choice, simply take the normal way of installing programs, and search for “Git”. Then, install it to the system. This could mean opening a terminal and using your Linux distribution’s package manager, or even an app store like “Gnome software”.

With the Git tool installed, we can use it to clone OneDrive-d’s code directly in the command line. Do this with:

git clone https://github.com/xybu92/onedrive-d.git

Then, enter the code directory to start the install process.

cd ~/onedrive-d

Installing OneDrive-D

The OneDrive-D code downloaded with Git contains a lot of different things; binaries, libraries, and different scripts, etc. Luckily, the developers made installing this software very straight-forward. They’ve written a Bash script that will completely configure the program, and get everything working. To start the installation process, simply run the script. This is done by running it as a program.

./install.sh

Running the script will allow it to start installing all of the little things that OneDrive-D needs to run correctly. Specifically, libraries, and other important tools that the program is built with will be installed. Be sure to enter your password (if asked) and allow the program to continue installing what it needs.

Configure OneDrive-D

Next in the process comes configuring OneDrive-D. This is necessary, as the program needs to connect to Microsoft servers and start the initial sync. Since OneDrive-D is a terminal based program, the initial program will not create a desktop icon, or anything like that. Instead, a command is required to start the configuration process. Start it in a terminal with:

onedrive-perf

There are 4 simple steps to this configuration process. The first step involves connecting the sync client to your Microsoft account. In the terminal, onedrive-perf will print out a one-time link. Paste this link into your default browser, and authorize OneDrive-D access to your Microsoft account to continue to step 2 of the process.

After clicking “yes” in the connection window, you’ll need to paste the callback URL back into the terminal. Not sure what that is? It’s the URL that the connection window redirects to. You’ll know you’re getting the right URL, because refreshing stops. A good giveaway is to look for “code=” in the URL.

Step two in the process is to tell OneDrive-D where to sync to. If you haven’t got a OneDrive sync folder on your PC already, now is the time to create one. Open another terminal and enter this command:

mkdir -p ~/OneDrive

Then, in step 2, tell the program where the folder is so that it can be used as the sync location. Be sure to use the full path: /home/username/OneDrive/

Step 1 and 2 are the most important parts of the configuration process. Steps 3 and 4 involve settings to do with both the numeric settings and the ignore file list. Most Microsoft OneDrive users will not need to do anything with steps 3 and 4. Enter “n” for no to get through both of these steps. If for some reason you feel like you want to edit these settings, choose Y instead to do so.

Note: be sure to change “username” to your PC’s username in the command.

Syncing with OneDrive-D

When the configuration process finishes, syncing can begin. Much like configuration, this needs to be done within the terminal. OneDrive-D runs in the background as a process. All that the user needs to do is start it. This is done with:

onedrive-d start

From here, the terminal can be closed at any time. OneDrive-D will continue running as a background program, uploading and downloading anything placed in the OneDrive sync folder. To turn off the background program, use this command:

onedrive-d stop

Conclusion

Microsoft OneDrive is one of the better cloud storage tools out there. It has great integration within the Windows desktop, along with neat features like integrating Microsoft Office, fast upload/download speeds and more. It’s no wonder some Linux users are begging Microsoft to bring this service and it’s features to their favorite operating system as well. Unfortunately, Microsoft has no plans to do so.

As Linux users, we’ll never be able to experience what it’s like to have this service baked into our operating system like Windows users do. Luckily, for those that need access to OneDrive and are willing to go without some of the flashy things, this program is a must. If OneDrive isn’t your preferred cloud storage, you can check out Google Drive. It’s fairly easy to access Google Drive on Linux.

Leave a comment

  • Datajanitor

    The “git clone” command requests a username and password.

    • Jon Ryder

      that’s YOUR un/pw for ubuntu.

  • Cuitlahuac Iriarte

    Excelente Guía, Gracias!!!

  • Alexandre Dénommée

    Thanks!

  • Joshua Raphael

    I just installed the chrome app and added it to desktop. Anything to stay off windows…

  • Barak Kalai

    I ran the commands but all i get when i start with onedrive start is that the daemon mode

  • pres10com

    Does this support conditional access?

  • Isaac Abad Rosas

    Error: setup script does not support your distro token elementary.

  • Kenneth Wong

    Thanks Derrik for this detailed and useful guide.

    Just that is there a typo in the command to use for configuring OneDrive? Should it be “onedrive-pref”?

  • Linux user

    after running `onedrive-pref`, it says ” [2017-11-06 17:19:35,251] DEBUG: thread_mgr: started. ” , and nothing more

  • Ed Nelson

    Worked like a charm on UBUNTU 16.04 LTS. Thanks a ton.

  • Cristian Acosta

    Good, run correctly !

  • colin

    worked a treat cheers

  • Toni Turnwald

    Hello, a few questions, after hours of installing and removing OneDrive, it finally runs on UBUNTU 16.04, thank you very much, but there is a small question left, hopefully I’ll get an answer. My question is; can I start “onedrive-d” at the startup of my system automatically ? And can it be run as long as my system is on ? Also does it run, when I go into “sleep” mode and after the waking-up, restart “onedrive-d” ?
    It would be great if I get an answer. cheerio Toni

  • colin

    It syncs folders and sub folder contents, but does not sync sub/sub folder contents? Any ideas of a fix for this?

    Cheers

  • Dave Ralston-Bryce

    With respect: I believe onedrive-perf command ought to be onedrive-pref
    Thanks for all your assistance as this process worked.

    • Yes, is still says to run “onedrive-perf” here 😀

      • Dave Ralston-Bryce

        Just type onedrive-pref and all is good. The writer made an error. Pref is short for Preference.

        • Yes I know that, I just wanted to point out that there is still an error here.

  • Max

    Thanks, that worked perfectly!

  • Joko Pawitro

    Hi thanks for the guide.. Is onedrive-d compatible with two step authentication?

    • Pete Ponchorat Maddison

      Yes, it does as I too have 2-step verification set up and I can still sync my folders.
      I’ve just installed it and it works great, I also installed the Google version, also with 2-step verification, which also works.

  • Martin Kloos

    Error: setup script does not support your distro token peppermint.

  • Jortiz3

    Does the onedrive sync service automatically start with linux? Or does this need to be configured and wasn’t mentioned in the article?

    • Jortiz3

      Turns out you start the service once using other instructions, and sync service will automatically start every-time you log in. Very condescending people in the github issues forum said so.

  • carol

    Great instructions, work flawlessly. I placed “onedrive-start” in startup applications with a delay of 20 seconds as well FYI. Installed on Linux-Mint using Ubuntu instructions. Thanks!

    • Gautham V Kunnath

      Can you please help me out, how did u do it

  • palani.t

    Thanks

  • Rocío Retamales O

    Hi! I have a question, when I try to open the program in the command tells me AttributeError: ‘module’ object has no attribute ‘MultiCommand’… What can I do? and if I can’t fix it, how can I uninstall the program?

    Thanks!

  • Gary Wakerley

    Hi
    Is there a solution yet to the sub folders not saving issue yet ?
    Thanks

  • Micheal Alemu

    Is this possible with a business account? I have a school account with a edu and it’s not letting me login from the link in step 1.

  • Hamidreza Mirtaheri

    please correct this “onedrive-perf”
    to this “onedrive-pref”

  • Pete Ponchorat Maddison

    Is it possible, after the program has bee installed, to change the name of the folder to which you are syncing?
    I ask because I have 2 accounts I wish to sync and it would be great to have them both accessible from the same computer.

  • Skinnyjean98

    No centos? what is wrong with this dude! he must be hating the reds.
    😀

  • Swapnil

    Please correct the command to onedrive-pref instead of onedrive-perf

    • Pete Ponchorat Maddison

      Judging by the lack of replies to our comments, I’d say this page is not being bonitored anymore, which says a lot about the developer…

  • Willem van Ede

    Works perfectly thanks for the help just one small comment: the text suggests using the command

    onedrive-perf but this should be onedrive-pref , for the rest thanks for the awesome guide

  • Paul

    Ok, but how can I manage multiple Onedrive accounts?