Microsoft OneDrive Business/Office 365 Pro offers 1 TB of cloud storage but unfortunately there has never been a method to sync it on Linux.

  • 2
    Welcome to Ask Ubuntu! We are a question and answer site, not a forum. Currently you have both a question and answer in the designated question section. Please edit your post to remove the answer and post that in the answer section below (there should be a button near the bottom of the page). Thanks!
    – Seth
    Jul 29, 2016 at 4:10
  • Possible duplicate of How to sync onedrive for business?
    – bmaupin
    Apr 24, 2017 at 14:23
  • None of the below worked for me. What worked is ExpandDrive expandrive.com , a payware solution. WARNING: I used to try to use ExpandDrive with Box, and it was very buggy: it kept crashing as I tried to edit LaTeX files in real time. ExpandDrive with OneDrive for Business appears less buggy, but I will repost if keeps crashing for me, as ExpandDrive for Box used to do. Aug 4, 2021 at 16:29

4 Answers 4


Ubuntu 18.04 and later


The below instructions to install from apt work, but the version in apt is too out-of-date and fails to parse the authorization URI. Instead, following the INSTALL.md doc to compile and install from source works:



There is a OneDrive client in the default Ubuntu repositories in Ubuntu 18.04 and later. OneDrive is the cloud storage system of Microsoft. This package provides the command line client specializing in synchronizing with OneDrive cloud storage.

Install it with:

sudo apt install onedrive

At first run, it asks you to authenticate with a link. After authentication you can enable the deamon with systemctl --user enable onedrive and then systemctl --user start onedrive.

It will monitor and sync OneDrive data locally in ~/OneDrive. Further explanations can be found in the manpage man onedrive. It's very easy to setup, and only takes about five minutes.

  • 8
    This doesn't work for OneDrive for Business
    – tricasse
    Oct 18, 2018 at 12:13
  • 2
    @tricasse It works for Office 365 Pro
    – Mattia_98
    Oct 19, 2018 at 9:04
  • 1
    The manpage of the onedrive package clearly states it doesn't support OneDrive for Business.
    – Tobias
    Dec 21, 2019 at 23:18
  • Does the onedrive for Business requires an administrator validation. Does it works if it get validated by an administrator? Why is it not specified in the answer? May 25, 2020 at 8:12
  • 1
    Actually authorization failed for me. Therefore I followed the instructions in github.com/abraunegg/onedrive/blob/master/docs/INSTALL.md to finally solve the issue. For now everything works fine.
    – cheffo
    Feb 23, 2021 at 16:20

Currently the experimental onedrive-d is an open-source program that can sync only personal OneDrive accounts as it does not accept Microsoft Sharepoint links. Here is a method to sync OneDrive Business/Office 365 using GoodSync for Linux, which is free for personal use.

  1. Install suitable version to your Linux machine eg:


    Answer by no for both GoodSync Connect setup and GsServer Web UI.

  2. Open OneDrive in a web browser. select "Return to Classic OneDrive" on the right lower side.
  3. The web address in your browser will now look like: https://xxxxxxx.sharepoint.com/xxxxxxxxxxx/Documents/Forms/All.aspx and based on it get your syncing link which will be office365://xxxxxxx.sharepoint.com/xxxxxxxxxxx/Documents.
  4. Create a new file in .goodsync subfolder in your home:

    gedit ~/.goodsync/jobs.tix
  5. Enter the following code in the file and save it:

    Name = "OneDrive_Sync"
    Side1 = <SideOptions>
    Dir = <Connect>
        Url = "put_your_syncing_link_here"
        UserID = "put_your_OneDrive/Office365_Bussiness_email_here"
    Side2 = <SideOptions>
    Dir = <Connect>
        Url = "file:///your_home_folder/one_drive_folder"
    Direction = 0
    ExcludeHidden = No
    ExcludeSystem = No
    DetectMovesAndRenames = Yes
    LinksOption = 1
    ExcludeEmptyFolders = No
    LimitChangesPercent = 100
    AutoResolveConflicts = 3
    DetectMovesAndRenames = Yes
  6. Start the syncing process:

    gsync sync "OneDrive_Sync"
  7. At this step your web Browser will open OneDrive/Office 365 page and ask for your authorization to allow goodsync to access your account. After entering your credentials syncing will start.

Limitations: Microsoft does not allow URL Requests with length of more than 270 character and so GoodSync CAN NOT sync files with long pathnames.


  • 3
    My web browser does not open the authorization page at step 7. Any idea how to do it manually?
    – pat-s
    Jan 31, 2018 at 13:15
  • 3
    My web browser not open to login also
    – Haha TTpro
    Jun 27, 2018 at 9:42
  • 2
    File system at office365:/.../Documents has been replaced by New OneDrive V2 API. Click Browse button to Re-Browse to your OneDrive sync folder, as New OneDrive requires browser-based authentication (OAuth2)
    – Ferroao
    Jul 9, 2018 at 15:23

rclone supports OneDrive for Business. See an article How To Mount OneDrive In Linux Using Rclone (Supports Business And Personal Accounts) - Linux Uprising Blog for usage.

Here is my example to setup a new remote onedrive1 with rclone 1.48.0 (on Fedora 30):

$ rclone config
2019/10/10 06:35:56 NOTICE: Config file ".config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive1
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
19 / Microsoft OneDrive
   \ "onedrive"
Storage> 19      
** See help for onedrive backend at: https://rclone.org/onedrive/ **

Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n

Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link:
Log in and authorize rclone for access
Waiting for code...
Got code
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1
Found 2 drives, please select the one you want to use:
0: OneDrive - Example Inc (business) id=b!gFLg-RRe****-T9B****
1: OneDrive - Example Inc (business) id=b!gFLg-RRe****-T-H****
Chose drive to use:> 1
Found drive 'root' of type 'business', URL: https://example-my.sharepoint.com/personal/myname_example_com/Documents
Is that okay?
y) Yes
n) No
y/n> y
Current remotes:

Name                 Type
====                 ====
onedrive1            onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

The drive 0's URL ends with /ElementinnerHTML and doesn't contain files in my case.

Then mount it on a local directory via command line, rclone-browser or web GUI since v1.49.


While the original and commonly used onedrived tool by xybu still does not support OneDrive for Business, but only personal OneDrives. however, there is a fork of this project on GitHub by derrix060 that has a somehow working (but still buggy) implementation for the Business client.

Warning: When you use this method, I highly recommend to always verify that the files got synchronized correctly by checking them online at https://www.office.com, and/or to use my wrapper script shown at the end of this page to at least get informed of any errors using desktop notifications!

Sometimes onedrived seems to fail picking up some changes or upload them correctly, leaving your OneDrive in a (partly) unsynchronized state. It can also happen that it generates merge conflicts with itself for some reason and renames your files locally by appending your host name in parentheses and optionally a number. Unfortunately there is no notification about errors, but you can see the entries in your logfile.

If this happens, you can make it try to synchronize the respective files again by e.g. touching them or renaming them or the folder they're in.

Tip: It seems like the onedrived​ library often has problems especially with files that were saved directly in the OneDrive root. It's probably better to put all files in subdirectories instead of dumping them directly into the OneDrive folder.

Although it sounds stupid, I also noticed that it seems to cause less problems to upload files through the OneDrive Web client and wait until they get synchronized back to your local folder (which can take several minutes though) than to create or copy/move them locally. Whether this is practical or totally voids the purpose of OneDrive is up to your own decision...

See the project's readme file for complete installation instructions, but here's a short summary:


  1. Make sure you have no other version of onedrived (or onedrive-d) installed.

  2. Install dependency packages:

    sudo apt install build-essential python3-dev libssl-dev inotify-tools python3-dbus libdbus-1-dev libdbus-glib-1-dev
  3. Download the latest ngrok client for Linux from the official website at https://ngrok.com/download. The ngrok-client package from the Ubuntu repositories is too old and doesn't meet the requirements.
    Unpack the downloaded ngrok-stable-linux-amd64.zip archive. It contains a single ngrok binary, which you should put in a location on your $PATH, e.g. into /usr/local/bin/.
    Signing up to ngrok is probably not necessary.

  4. Install the onedrived Python3 application from GitHub using pip3:

    sudo -H pip3 install git+https://github.com/derrix060/onedriveClient.git
  5. Optionally configure a logfile location for onedrived, where you can check for problems if anything should not work correctly, e.g.:

    onedrived-pref config set logfile_path ~/.config/onedrived/onedrived.log

Account setup and drive configuration

After the installation was successful, you have to configure your account and drive(s):

  1. Add your OneDrive for Business account using the interactive mode by running:

    onedrived-pref account add -b

    The interactive wizard will ask you twice to open a link in your browser, where you will have to authorize the application with your Microsoft Business account.
    It will ask you to paste the URL you get redirected to after confirming the authorization back into the interactive wizard. Please do as told and follow the instruction the command gives you.

  2. Verify the account got added successfully by checking the output of the command below. It should look similar and list the account you are logged in with:

    $ onedrived-pref account list
    All OneDrive accounts associated with user "YOUR_UBUNTU_USERNAME":
      #  Account ID                 Owner Name     Email Address         Profile Type
    ---  -------------------------  -------------  --------------------  --------------
  3. Configure your drives in the interactive command mode by running:

    onedrived-pref drive set

    You will see a list of all your drives and get asked to enter the row number of the drive you want to add to your local configuration.
    You then have to specify a local directory that you want to use as root folder for synchronizing with your drive. You can just hit Enter and it will use the default ~/OneDrive. If the path does not exist, it will be created. Same thing for the path to the ignore file you want to use, you can just hit Enter and it will use the default ~/.config/onedrived/ignore_v2.txt and create it, if necessary.

  4. Check the output of the command below to display the information about all available and configured drives. It should show the drive you just set up with the correct settings under the headline Drives that have been set up:

    onedrived-pref drive list

Launching the daemon

Now that your drive is configured, you need to try and start the onedrived daemon. I recommend to launch it in debug mode first, in case there are any problems you would otherwise miss. This will start onedrived in foreground:

onedrived start --debug

If everything is okay and the command does not crash and exit, try putting some files on your local OneDrive folder and see if it synchronizes. You should probably be able to verify that by visiting the OneDrive web application at https://www.office.com and checking if the files you added locally are appearing there.

You can quit the onedrived process in your terminal again by pressing Ctrl+C.

To launch onedrived normally, as a background daemon, run it with:

onedrived start

You should probably add this command to your Startup Applications, so that it auto-starts every time you log in. Please refer to How do I start applications automatically on login? for that.

Wrapper for error notifications

If you want to get desktop notifications whenever onedrived logs an error (e.g. failed file synchronization), here is a wrapper script that parses the log file in real-time and uses notify-send to display them to you.

You can start the wrapper script without arguments (or put it in your auto-start applications) instead of the onedrived start command.


onexit () {
    onedrived stop
    notify-send -i "$ICON_STOP" "OneDrive" "Wrapper stopped"
    echo "onedrived-wrapper stopped"

trap onexit EXIT

onedrived stop
echo "---" >> "$LOGFILE"

onedrived start || {
    echo "Failed to start onedrived!"
    exit 1
notify-send -i "$ICON_START" "OneDrive" "Wrapper started"

echo "Monitoring onedrived.log for error messages..."
tail -n 1 -F --pid="$(pgrep -f "onedrived start")" "$LOGFILE" |
    while read LINE ; do
        echo "$LINE"
        if MESSAGE="$(grep -Pio '(?<=ERROR: ).*' <<< "$LINE")" ; then
            notify-send -i "$ICON_ERROR" "OneDrive Error" "$MESSAGE"
  • I still get the message "Failed to authorize onedrived: interaction_required." after I enter the second link for authenticating the ODfB account. Any ideas why this might happen?
    – Jimakos
    Jul 26, 2018 at 14:57
  • @Jimakos Sorry, I never encountered that message. No idea unfortunately.
    – Byte Commander
    Jul 26, 2018 at 15:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.