Install & Setup OneDrive Client in Ubuntu 24.04 | 22.04

Last updated: April 29, 2024 — 10 Comments

This is a step by step beginners guide shows how to install and setup OneDrive client in Ubuntu 22.04 and Ubuntu 24.04 to sync files between local machine and Microsoft cloud.

OneDrive is a file hosting service by Microsoft. It so far does not have an official app for Linux, but there’s a popular free open-source client works in most Linux. And, here’s the basic how to guide for installing and using it in Ubuntu Linux.

Method 1: Ubuntu 24.04 with default GNOME Desktop only

GNOME 46 introduced onedrive support in its Online Accounts integration. Meaning, Ubuntu 24.04, Fedora 40 Workstation, and other other Linux with the latest GNOME can follow the steps below to get OneDrive integration in file manager.

1. First, press Super (Window Logo) + S to open top-right system tray menu (aka Quick Settings), then click open “Settings” utility.

2. When it opens, navigate to Online Accounts in the left, then click MicroSoft 365 in right. In will open up a web page, and ask to login and grant permissions  to access your onedrive files.

3. After successfully login your account, you’ll see it listed in the settings page. By clicking on it will pop-up the dialog, with option to toggle on/off onedrive access, and button to remove the Microsoft 365 account at anytime as you want.

And, you can re-open “Files”, aka Nautilus file manager, and click you account name in left panel to access OneDrive files.

Method 2: for Ubuntu 22.04/24.04 with any desktop environments:

Step 1: Install OneDrive Client:

Option 1: Install it from system repository
The client package is available in most Linux repositories, including Ubuntu.

For Ubuntu users, simply press Ctrl+Alt+T on keyboard to open terminal. and run command to install it:

sudo apt install onedrive

Option 2: Install from third-party repository
OneDrive package in Ubuntu 22.04 and Ubuntu 20.04 repository is old. If you would like to get the latest version, then here’s a third-party repository available.

1. First, click the link below to go to the OBS repository:

2. In that web page, click on Ubuntu logo, select “Grab binary package directly“, then click download the .deb package for your system.

In case you don’t know which Ubuntu version is currently running, open terminal (Ctrl+Alt+T) and run cat /etc/os-release and dpkg --print-architecture commands to tell.

3. Finally, right-click on your Downloads folder and click “Open in Terminal“, and run command in pop-up terminal to install the .deb package.

sudo apt install ./onedrive*.deb

Step 2: Authorize with your OneDrive Account

Before being able to upload or download files, you have to first authorize the app with your OneDrive account.

1. To do so, simply open terminal (Ctrl+Alt+T) and run command:


Then, copy the output link url and open in web browser.

2. In the web page, click “Accept” button to grant permissions to access your OneDrive account.

3. After that, the web page will be redirect to a blank page. Just copy the url of that blank page, and paste into the terminal window and hit Enter.

If done successfully, the terminal will output somethings says ‘Application has been successfully authorized‘.

Step 3: Sync files between local folder and OneDrive cloud.

After authorized the app, you can now try running the client in terminal (Ctrl+Alt+T) by running command:

onedrive --dry-run --synchronize

This command will run the client to test the configuration. No files will be downloaded, uploaded or removed! A OneDrive folder will be created (if not exist) in your user home directory for syncing files.

To start syncing files, run command:

onedrive --synchronize

Or use onedrive --synchronize --local-first to upload local files (from user’s OneDrive folder) first then download from cloud.

For choice, you may sync only single folder only, for example “Pictures” sub-folder under OneDrive directory, by running command:

onedrive --synchronize --single-directory 'Pictures'

Or, do uploading local files only via command:

onedrive --synchronize --upload-only

There’s also --download-only command option to only download differences from cloud to local, and --no-remote-delete to NOT remove files that previously synced but later manually deleted.

Step 4: Sync files automatically

If everything goes OK, you may also start OneDrive as systemd service, so it does the file sync between cloud and local folder automatically.

To do so, simply run command in terminal (Ctrl+Alt+T) to enable the service:

systemctl enable --user onedrive

Then, start it by running command:

systemctl start --user onedrive

Finally, check the service status by running command systemctl status --user onedrive.

Once the service is in active running status, try making difference in either local or cloud OneDrive folder, then check in another side to see if it works.

Step 5: Config OneDrive client

If the default sync options do not meet your need, then, run command to copy example config file to local folder:

sudo cp /usr/share/doc/onedrive/config ~/.config/onedrive/

Then, change the ownership from root to your user:

sudo chown $USER:$USER ~/.config/onedrive/config

Finally, either open file manager (press Ctrl+H to view hidden files/folders), navigate, and click edit the file. Or, run command:

gedit ~/.config/onedrive/config

For Ubuntu 23.10+, replace gedit with gnome-text-editor. For non-GNOME Desktop, replace it with your text editor, or use nano command line editor works in most desktops.

When file opens, un-comment (remove # at the beginning) to enable any option and change its value as you want, such as sync folder, exclude files/folders, upload only or download only, and more, and finally save the file.

Finally, run command systemctl restart --user onedrive to restart service to apply the changes. For more about how to use OneDrive client, see the official docs.

Uninstall OneDrive:

If you don’t to use the client anymore, open terminal (Ctrl+Alt+T) and run command to stop and disable the service:

systemctl disable --now --user onedrive

Then, remove the client package by running command:

sudo apt remove --autoremove onedrive

For choice, you may clear the leftovers by deleting them via commands:

sudo rm /etc/logrotate.d/onedrive
rm -R ~/.config/onedrive


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via Buy me a coffee:

10 responses to Install & Setup OneDrive Client in Ubuntu 24.04 | 22.04

  1. Thanks, Ji!
    Your tutorials are simply the best.

  2. thanks for sharing. Lovely Job.
    Best wishes

  3. Thanks for your tutorials ! It helps a lot

  4. Hi Ji, thank you for your tutorial, but I have one problem. After installing one drive client in Ubuntu 23.10, copy the link to authorize the app in microsoft, I sign into my account and nothing happens. The page goes blank and stays there. Any idea?

  5. Hi Ji m,

    the tutorial was really helpful, thanks!
    But I have a problem, the sharepoint taht I share with my colleagues do not sync, I went into the options and tried:
    sync_business_shared_folders = “true”
    but it didn’t do anything. Do you know how I can proceed?

  6. Thanks for this tuto. Very helpfull !
    The next step is to have the Ubuntu 24.04 Onedrive automatically mounted at startup.
    How to do this ? What is the CLI to use ?

  7. Are there any known issues using authenticator code?

  8. Thank you very much for this explanation, it was really helpfull.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>