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.
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:
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”.
Im nächsten Schritt wird unser OneDrive, nebst ID angezeigt. Hier bestätigen wir die Nummer des Accounts. Im Normalfall wird nur eins angezeigt, also 1 eingeben.
Hat alles geklappt, wird dies in Form der URL und ID angezeigt. Hier wählen wir erneut “Yes” aus, dass alles passt.
Ist alles richtig, bestätigen wir dies im letzten Schritt mit Enter, bzw. Yes.
Fertig! OneDrive ist nun konfiguriert und einsatzbereit.
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.