How to use OneDrive in Linux.
Linux and cloud services, not so easy. It feels like only Dropbox offers its own client. Google Drive and OneDrive do not offer their own clients. Presumably, the target group is simply not large enough or prefers to set up a NextCloud itself. I use OneDrive myself.
Now I was looking for ways to access it. One solution is the software ExpanDrive. The software costs money, but offers support for all sorts of cloud services. Stupidly, the software did not want to work under openSuse.
Video
Rclone access to cloud services for Linux
This is where Rclone comes in, a command line tool for accessing all sorts of cloud services. The tool allows you to mount cloud storage in Linux. In the approach shown here, we mount OneDrive in Linux. The files are online and are not stored locally.
Setup RClone for OneDrive
Let’s start with the installation of Rclone. This is done under Linux with the following command:
curl https://rclone.org/install.sh | sudo bash
Once this is done, we can set up Rclone and configure OneDrive:
rclone config
With “n” we create a new “Remote”. This is followed by a list of supported services. As we can see here, numerous other cloud services can be integrated in addition to OneDrive.
OneDrive is number 32. Further questions follow, e.g. for the “client_id” or the “client_secret”. We do not have to specify either of these things and simply confirm them with Enter.
A query about the region follows. Here we also simply select the first option “Microsoft Cloud Global”.
When asked for “advanced config” we press “n” for No.
Also in the next step we choose the path of least resistance and select the “auto config” with “Yes”.
This will now open a browser window. Here we now have to log in to Microsoft and grant Rclone the access rights.
Another prompt appears, this time asking for the type of connection. Here we select 1, “OneDrive Personal or Business”.
In the next step, our OneDrive, along with ID is displayed. Here we confirm the number of the account. Normally only one is displayed, so enter 1.
If everything has worked, this is displayed in the form of the URL and ID. Here we select “Yes” again that everything fits.
If everything is correct, we confirm this in the last step with Enter, or Yes.
Done! OneDrive is now configured and ready to use.
Mount OneDrive
In order to use OneDrive, we need to mount it. To do this, we create a folder, for example in the home directory with the name “OneDrive”.
After that, we can mount OneDrive to the folder, using the following command:
rclone --vfs-cache-mode writes mount onedrive: ~/OneDrive
At every restart the thing is gone, who wants can build a script from it and put it in the autostart.
In the folder “OneDrive” we can now access our OneDrive files.
Notes on use
There is not so much to consider when using it. The synchronization takes place in the background. However, everything is online, the files are not stored on the computer. So an internet connection is mandatory.
The upload and download takes place in the background. For larger files, the process takes a little time, so you should make sure that the upload is completed before the computer is turned off.
There are only 5 reliable ways to access OneDrive on Linux/Unix platforms:
* Via the OneDrive Client for Linux – https://github.com/abraunegg/onedrive – this ‘syncs’ your data, bi-directional operation, open source and free. Supports Personal, Business & SharePoint account types and Shared Folders. A Docker container is also available for all major architectures (x86_64, ARMHF, AARCH64). If you need a GUI for onedrive client management use: https://github.com/bpozdena/OneDriveGUI
* Via the ‘onedriver’ client – https://github.com/jstaf/onedriver – Native file system that only provides the OneDrive ‘on-demand’ functionality, open source and free. Supports Personal, Business account types. Currently does not support Shared Folders or SharePoint.
* Via ‘rclone’ – https://rclone.org/ – one way sync client, open source and free. Has limitations with SharePoint.
* Via non-free clients such as ‘insync’, ‘ExpanDrive’
* Via the web browser of your choice
Thanks for the list. Some I did not know yet, I will have a look.