How to use rclone to mount OneDrive share in Ubuntu

General documentation

Download and install rclone if not already installed Download .deb installer https://downloads.rclone.org/v1.58.1/rclone-v1.58.1-linux-amd64.deb

Install rclone $sudo dpkg -i ~/Download/rclone-v1.58.1-linux-amd64.deb

Make a mountpoint for the OneDrive share. This can be any name you like, but if you use something different, make appropropriate changes later in this script. $ mkdir ~/OneDrive

Configure rclone. This is a recording of the process to configure rclone. The users input is in red. %CODE{"sh"}% dalep@biostat1468:~$ rclone config No remotes found, make a new one? n) New remote s) Set configuration password q) Quit config n/s/q> n name> remote_vumc
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Digital Ocean, Dreamhost, IBM COS, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Compress a remote
   \ (compress)
12 / Dropbox
   \ (dropbox)
13 / Encrypt/Decrypt a remote
   \ (crypt)
14 / Enterprise File Fabric
   \ (filefabric)
15 / FTP Connection
   \ (ftp)
16 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
17 / Google Drive
   \ (drive)
18 / Google Photos
   \ (google photos)
19 / Hadoop distributed file system
   \ (hdfs)
20 / Hubic
   \ (hubic)
21 / In memory object storage system.
   \ (memory)
22 / Jottacloud
   \ (jottacloud)
23 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
24 / Local Disk
   \ (local)
25 / Mail.ru Cloud
   \ (mailru)
26 / Mega
   \ (mega)
27 / Microsoft Azure Blob Storage
   \ (azureblob)
28 / Microsoft OneDrive
   \ (onedrive)
29 / OpenDrive
   \ (opendrive)
30 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ (swift)
31 / Pcloud
   \ (pcloud)
32 / Put.io
   \ (putio)
33 / QingCloud Object Storage
   \ (qingstor)
34 / SSH/SFTP Connection
   \ (sftp)
35 / Sia Decentralized Cloud
   \ (sia)
36 / Storj Decentralized Cloud Storage
   \ (storj)
37 / Sugarsync
   \ (sugarsync)
38 / Transparently chunk/split large files
   \ (chunker)
39 / Union merges the contents of several upstream fs
   \ (union)
40 / Uptobox
   \ (uptobox)
41 / Webdav
   \ (webdav)
42 / Yandex Disk
   \ (yandex)
43 / Zoho
   \ (zoho)
44 / http Connection
   \ (http)
45 / premiumize.me
   \ (premiumizeme)
46 / seafile
   \ (seafile)
Storage> onedrive
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id> 
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> 
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
 1 / Microsoft Cloud Global
   \ (global)
 2 / Microsoft Cloud for US Government
   \ (us)
 3 / Microsoft Cloud Germany
   \ (de)
 4 / Azure and Office 365 operated by 21Vianet in China
   \ (cn)
region> global
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> y
2022/06/27 13:52:14 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=eU6tgGOGfApvrdlZWvWGxQ
2022/06/27 13:52:14 NOTICE: Log in and authorize rclone for access
2022/06/27 13:52:14 NOTICE: Waiting for code...
2022/06/27 13:52:16 NOTICE: Got code
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
 1 / OneDrive Personal or Business
   \ (onedrive)
 2 / Root Sharepoint site
   \ (sharepoint)
   / Sharepoint site name or URL
 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
   \ (url)
 4 / Search for a Sharepoint site
   \ (search)
 5 / Type in driveID (advanced)
   \ (driveid)
 6 / Type in SiteID (advanced)
   \ (siteid)
   / Sharepoint server-relative path (advanced)
 7 | E.g. /teams/hr
   \ (path)
config_type> onedrive
Drive OK?

Found drive "root" of type "business"
URL: https://vumc365-my.sharepoint.com/personal/dale_plummer_vumc_org/Documents

y) Yes (default)
n) No
y/n> y
--------------------
[remote_vumc]
type = onedrive
token = {"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6ImVFM3E0Q0wzbXI2SDR5eUs4S2tmMXZrVmpvY3dZbUc5alVjRW50RFQzY2MiLCJhbGciOiJSUzI1NiIsIng1dCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSIsImtpZCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9lZjU3NTAzMC0xNDI0LTRlZDgtYjgzYy0xMmM1MzNkODc5YWIvIiwiaWF0IjoxNjU2MzU1NjM2LCJuYmYiOjE2NTYzNTU2MzYsImV4cCI6MTY1NjM2MTA4MSwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkUyWmdZREQ1SGpmUld1UEZpVWxKQjJvUGNQOUsyL2ZNTDBycmdRSmJ2Tm4wajdXUGd5MEIiLCJhbXIiOlsicHdkIl0sImFwcF9kaXNwbGF5bmFtZSI6InJjbG9uZSIsImFwcGlkIjoiYjE1NjY1ZDktZWRhNi00MDkyLTg1MzktMGVlYzM3NmFmZDU5IiwiYXBwaWRhY3IiOiIxIiwiZmFtaWx5X25hbWUiOiJQbHVtbWVyIiwiZ2l2ZW5fbmFtZSI6IldhbHRvbiIsImlkdHlwIjoid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D_LR8ACMbaVlhJ6ANdaoluX82hkYvp6LojRnJLjbn9bNVmlzxUdRtiPCrx2T0RxeM3yqpSkQmcMqfAzfxy9-BjX2KNACYm8O4YRludc6SXsESTyWxzxiKT7e874m8ptWP8","expiry":"2022-06-27T15:18:01.081049274-05:00"}
drive_id = b!rQ1BSNglrESx0BaL3OI3ElRVRM0SKdNAqX_mwl1pxTNxgi1ynclWRr7DSfS1He2D
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
remote_vumc          onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
%ENDCODE%

Map the OneDrive share
dalep@biostat1468:~$ /usr/bin/rclone --vfs-cache-mode writes mount remote_vumc: ~/OneDrive/ &

See if it worked
dalep@biostat1468:~$ ls -la OneDrive/

This mount will remain actice as long as you keep this terminal running.  If you'd like to mount
the share when the system is booted, add this command to your crontab.
#@reboot ( /usr/bin/rclone --vfs-cache-mode writes mount remote_vumc: ~/OneDrive/ &)&


This topic: Main > TWikiUsers > DalePlummer > DalesNotes > RcloneSetup
Topic revision: 27 Jun 2022, DalePlummer
 
This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback