1. Home
  2. Linux
  3. Access microsoft onedrive on 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.

41 Comments

  1. Got to the end of process and the sync fails Terminal message is
    [2020-11-05 12:50:50,826] DEBUG: MainThread: running in daemon node.
    Starting onedrive-d … FAILED
    ERROR: Child exited immediately with exit code 127

    Not sure what to do next

    • This error is likely due to your account having two-factor authentication. As far as I know, this program has issues with that. For more help, the developers of the app have a bug tracker. https://github.com/xybu/onedrive-d-old/issues/198

  2. I got this message:

    Media change: please insert the disc labeled
    ‘Lubuntu 18.04 LTS _Bionic Beaver_ – Release amd64 (20180426)’
    in the drive ‘/media/cdrom/’ and press [Enter]
    ^C
    And then the onedrive-pref was not found, lesading me to believe the program did not install completely. I never had a Ubuntu CD I installed Lubuntu from a USB drive. Any idea how to finish the installation? Or at the very least clean up any lose ends to the install process that might cause a problem later?

  3. 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

    • 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…

  4. 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.

  5. 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.

  6. 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!

  7. 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!

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

    • 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.

    • 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.

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

    • 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.

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

    Cheers

  11. 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

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

  13. 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”?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.