Use the rclone installation script by entering the following command in a terminal window:
$ curl https://rclone.org/install.sh | sudo bash
Alternative installation instructions are available from the rclone website: https://rclone.org/install/
To access OneDrive files using rclone, you need to configure an rclone remote.
A remote can be thought of as a named local configuration of a remote file store (the information required to access OneDrive in this case).
1. Run the rclone config command in a terminal, using the command:
rclone config
2. When presented with the config menu (shown below) press the n key followed by Enter
Provide a name for the new remote, this will be how you will uniquely identify the remotes that you have configured. Below we’ve used the name OneDrive. Then press enter.
4. Select the type of online account that rclone will be accessing. When prompted, either type onedrive or enter the number that corresponds to the onedrive online storage in the output list of available options
5. Leave the following 2 steps blank (default) by pressing Enter for each of them
6. Unless you’re already familiar with rclone and require some advanced configuration, enter n for the advanced config option
7. You can allow rclone to automatically configure the remote by entering y for the Remote config prompt
8. A new tab will appear in your web browser window and present the Microsoft login screen (login.microsoft.com). If the browser tab isn’t automatically opened, a link is provided in the terminal
Unless already logged in, you’ll need to enter your email address in the form of username@sussex.ac.uk and select Next
You will then be redirected to the university’s single sign on login page. Enter your password and then Sign in
When signed a success message will appear in the browser window
9. Back in the terminal, choose “onedrive” (or the corresponding number for a onedrive file store, in this case 1) to access
10. If more than one drive is found, you may now be presented with an option to choose which drive to use. Select the one to use by entering the corresponding number.
11. Information about the chosen drive will appear followed by a confirmation prompt to which, type y to confirm
12. An overview of your current remotes now includes the newly created OneDrive remote, from here you can exit the configuration menu by pressing q
Now the remote has been configured there are several commands available which are analogous to common linux command line programs such as rclone ls , rclone touch , rclone rmdir – a full list can be found using rclone help or documentation available on the rclone website.
A remote can be mounted locally using the rclone mount command as shown below which requires an empty directory to exist to use as the mount point. The “--vfs-cache-mode writes" option enables local caching of files for writing, without this option some files, such as .docx and .xslx files, won’t be writeable.
$ mkdir –p ~/Documents/OneDrive
$ rclone mount --vfs-cache-mode writes OneDrive:/ ~/Documents/OneDrive/
Once mounted, you should now find the remote mounted within your file browser to allow for GUI interaction with your OneDrive files.
To unmount:
$ fusermount -u ~/Documents/OneDrive
Automatically mounting onedrive files on system startup
You can automate the mounting of our OneDrive files upon login by adding the following lines to the ~/.profile file:
if ! mountpoint -q ${HOME}/Documents/OneDrive
then
/usr/bin/mkdir -p ${HOME}/Documents/OneDrive
/usr/bin/rclone mount \
--allow-non-empty \
--config=${HOME}/.config/rclone/rclone.conf \
--daemon \
--vfs-cache-mode writes \
OneDrive:/ ${HOME}/Documents/OneDrive
fi
created on 2020-06-22 by Alexander Butler
last updated on 2020-06-22 by Alexander Butler