OneDrive Linux Setup and Configuration Guide

Author

Reads 277

Crop anonymous male looking through files and folder in box placed on desk with green bankers lamp in home office
Credit: pexels.com, Crop anonymous male looking through files and folder in box placed on desk with green bankers lamp in home office

To set up OneDrive on Linux, you'll need to install the OneDrive client package from the Microsoft repository. You can do this by running the command `sudo apt-get update && sudo apt-get install onedrive`.

First, you need to enable the Microsoft repository on your system. This can be done by running `sudo apt-get install apt-transport-https` and then adding the repository by running `wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -`.

To configure OneDrive on Linux, you'll need to enter your Microsoft account credentials. This can be done by running the command `onedrive setup`.

Broaden your view: Nextcloud Set up

Configuration

If you're looking to configure the OneDrive client for Linux, you can refer to the advanced-usage.md document for more information. This document covers various topics, including configuring the client to use multiple OneDrive accounts or configurations.

One of the ways to set up multiple OneDrive accounts is by using Docker, which allows for more flexibility and control. However, this method can be complex and may require some technical expertise.

Credit: youtube.com, "How To Use Microsoft OneDrive With Ubuntu Linux – Step By Step Guide"

For users of GNOME (Ubuntu 24.04), you can set up your OneDrive account through the "Online Accounts" option in Settings. This option allows you to sync your files, but it only works with GNOME 46.1 and has some known issues. To use this option, you need to leave the "Client ID" and Advanced fields blank and click "Sign In".

Advanced Configuration

If you're looking for more control over your OneDrive client on Linux, you can explore advanced configuration options.

To sync multiple OneDrive accounts, you can configure the client to use multiple OneDrive accounts or configurations. This is a feature that's not immediately obvious, but it's available for those who need it.

For those using Docker, you can configure the client to use multiple OneDrive accounts or configurations using Docker. This can be a bit more complex, but it's a great option for those who are already familiar with Docker.

Credit: youtube.com, ConsoliDator+ MasterClass: Week 9 - Advanced Configuration

If you're using a dual-boot setup with Windows and Linux, you can configure the client to work seamlessly between the two operating systems. This is especially useful for those who need to access their files from both environments.

When syncing files, the client can be configured to use a mounted directory as the sync directory. This is a convenient option for those who need to sync files from a specific location.

You can also configure the client to upload data from the local ~/OneDrive folder to a specific location on OneDrive. This is a useful feature for those who need to share files between their local machine and OneDrive.

Here are some specific configuration options to explore:

  • Configuring the client to use multiple OneDrive accounts / configurations
  • Configuring the client to use multiple OneDrive accounts / configurations using Docker
  • Configuring the client for use in dual-boot (Windows / Linux) situations
  • Configuring the client for use when 'sync_dir' is a mounted directory
  • Upload data from the local ~/OneDrive folder to a specific location on OneDrive

Application Version

To ensure your application is running smoothly, make sure you're using the latest version. You can check your current version by typing onedrive --version in your command line.

Upgrading your client is a good idea if you're running an older version, as it will give you access to new features and bug fixes.

The minimum required version is, so make sure you're at least running this version to avoid any issues.

Usage and Syncing

Credit: youtube.com, How to Sync Microsoft OneDrive in Linux Mint

To use OneDrive on Linux, you'll need to run the client in the terminal window by typing "onedrive" to create the default configuration file. This will allow you to access and manage your OneDrive files in the Linux file system.

You can also use an unofficial OneDrive client, which can be installed on a Debian or Ubuntu-based Linux system. To do this, you'll need to add the correct repository and repository keys, and then install the client using the "wget" command.

To sync your OneDrive files, you can use the "--sync" command, which will synchronize your files from your Microsoft OneDrive account to your local directory. You can also use the "--single-directory" command to sync a single directory, or the "--sync-list" file to specify which files and directories to sync.

Here are some ways to skip directories from syncing:

  • Employ 'skip_dir' as part of your 'config' file to configure what directories to skip
  • Employ 'sync_list' to configure what files and directories to sync, and what should be excluded
  • Employ 'check_nosync' as part of your 'config' file and a '.nosync' empty file within the directory to exclude to skip that directory

Note that after changing any Client Side Filtering rule, you must perform a full re-synchronisation by using --resync.

Selective Sync List

Credit: youtube.com, Microsoft OneDrive | OneDrive Sync Explained

The OneDrive Client for Linux allows you to create a selective sync list to specify which files and directories you want to sync.

You can create a file named sync_list in your application configuration directory to enable selective synchronisation. This file excludes everything by default on OneDrive.

Each line of the sync_list file represents a relative path from your sync_dir. All files and directories not matching any line of the file will be skipped during all operations.

The use of / is critically important to determine how a rule is interpreted. It is very similar to ** wildcards, for those that are familiar with globbing patterns.

Here is an example of sync_list:

  • Use the * to wildcard select any characters to match for the item to be included
  • Use either ! or - characters at the start of the line to exclude an otherwise included item

After changing the sync_list, you must perform a full re-synchronisation by adding --resync to your existing command line.

Credit: youtube.com, Tip: Selective Sync

When enabling the use of 'sync_list,' utilise the --display-config option to validate that your configuration will be used by the application, and test your configuration by adding --dry-run to ensure the client will operate as per your requirement.

In some circumstances, it may be required to sync all the individual files within the 'sync_dir' root, but due to frequent name change / addition / deletion of these files, it is not desirable to constantly change the 'sync_list' file to include / exclude these files and force a resync. To assist with this, enable the following in your configuration file:

This will tell the application to sync any file that it finds in your 'sync_dir' root by default, negating the need to constantly update your 'sync_list' file.

A sample sync_list file might look like this:

  • /path/to/include
  • ! /path/to/exclude

This will include all files and directories under /path/to/include, and exclude all files and directories under /path/to/exclude.

Activity Log Example

Credit: youtube.com, Activity Logs: Monitor and Export How To

To view your client activity log, you can execute the command onedrive with the --sync and --enable-logging flags.

The log will be in the format of %username%.onedrive.log, where %username% represents the user who ran the client.

Onedrive logs will be written to the /var/log/onedrive/ directory by default.

You'll need to ensure this directory exists and that your user has the necessary permissions to write to it.

If the directory doesn't exist, you can create it by performing the necessary steps for your system.

The log will contain all actions taken by the client, allowing you to easily track user activity.

An example of a client activity log for the command onedrive --sync --enable-logging is shown below:

The log will also contain more detailed information if you use the --verbose flag.

You can view the logs by executing the command to view the logs.

For more insights, see: Onedrive Logs

Creating a shareable link is a great way to collaborate with others on a file. You can generate a shareable file link and provide it to other users for accessing a specific file.

Credit: youtube.com, How to share files on OneDrive - The Complete Guide

To create a shareable link, employ the command that allows read-only access to the file by default. The order of the file path and option flag is crucial.

To make the shareable link a read-write link, you'll need to execute a different command. This will give the users with the link the ability to edit the file.

The shareable link can be accessed by anyone with the link, making it a convenient way to collaborate on files.

Frequently Asked Questions

What is the best OneDrive for Linux?

For a seamless OneDrive experience on Linux, consider ExpanDrive, a powerful client that supports popular distributions and offers two-way sync via a mounted drive. It securely connects to the Microsoft Graph API for OneDrive, OneDrive for Business, and SharePoint.

Does OneDrive work on Linux Reddit?

Yes, OneDrive can be accessed on Linux systems with a good internet connection. You can mount it as a local drive using tools like rclone, making it a convenient option for remote work.

What is the Linux equivalent of OneDrive?

For Linux users, Google Drive is a good alternative to OneDrive, offering 15 GB of free storage and various client options, including Grive2 for CLI users. If you prefer a more powerful client, consider Insync for a seamless experience.

Francis McKenzie

Writer

Francis McKenzie is a skilled writer with a passion for crafting informative and engaging content. With a focus on technology and software development, Francis has established herself as a knowledgeable and authoritative voice in the field of Next.js development.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.