Body
Overview
OneDrive is easily accessible from Windows systems, but it can also be used from a Linux system. There are several different methods available, but this document concentrates on using OneDriver, an open-source tool, on Red Hat Enterprise Linux systems. Note that these instructions also apply to Red Hat-like systems such as CentOS or Fedora.
Installation
You can find out if OneDriver is installed on your system by using the which command to see if the onedriver program is available. For example:
[user@hostname ~]$ which onedriver
/usr/bin/onedriver
[user@hostname ~]$
In this example, OneDriver is installed. If you get an error message containing “no onedriver in” then the package has not been installed, so you must proceed with the following steps.
OneDriver is available via Fedora’s COPR (Cool Other Projects Repository) for Red Hat-like systems. Use the following commands to enable it and install the package:
sudo dnf copr enable jstaf/onedriver
sudo dnf install onedriver
These commands must be run by a user with administrative access to the system. At this point, each user will be able to enable OneDriver in their individual accounts.
Configuration
Using a GUI
OneDriver includes a setup utility that can be used to mount OneDrive using a graphical interface. It can usually be found in the Accessories folder in your GUI under the name OneDriver, but the location will vary depending on the desktop environment you are using. If you cannot find it in the menus, you can launch it from the command line using the onedriver-launcher command in a terminal window.
Once launched, you should see the OneDriver GUI:
In this example, there are no existing OneDrive connections defined yet.
To add a new connection, click the “+” sign in the upper-left corner. You will first be asked where you want OneDrive to be mounted. Once that has been defined, you will be asked to log in to the OneDrive account you want to use.
Once you have successfully connected, the GUI app will show the connection:
The OneDrive connection will be reestablished every time you log in to the system.
From the Command Line
For an individual user using the command line interface, OneDriver can be enabled by adding a user-level service to systemd. Each user that wants to mount their OneDrive should use the following instructions.
The user should create a directory on which OneDrive will be mounted, define the service in systemd, and enable the service using the following commands:
mkdir ~/OneDrive
export SERVICE_NAME=$(systemd-escape --template onedriver@.service --path ~/OneDrive)
systemctl --user daemon-reload
systemctl --user start ${SERVICE_NAME}
Note that the ~/OneDrive is arbitrary and refers to a directory named OneDrive in the current user’s home directory. The mount point could be any valid Linux filename.
If you are working from the command line, or a system on which a web browser is not available, you can use the following command to initialize the connection to OneDrive:
onedriver --auth-only --no-browser ~/OneDrive
Instructions will be printed on screen. Copy the URL and paste it into a browser on another system to continue, then complete any authentication steps the process requests. Upon login, you should be presented with a blank page. Copy the URL from the address bar of the blank browser window and paste it into the command line on the target system, which will update the OneDriver configuration for the account. Once complete, the user’s OneDrive should be visible as a mounted volume.
To enable onedriver to mount the drive at login time, execute the following commands:
export SERVICE_NAME=$(systemd-escape --template onedriver@.service --path ~/OneDrive)
systemctl --user enable ${SERVICE_NAME}
After that, systemd will start the service and mounted OneDrive when the user logs in.
Other Operating Systems
For instructions on installing onedriver on other Linux systems, see the projects Github repository.