1、windows下载rclone-v1.51.0软件
https://rclone.org/downloads/。然后解压出来,比如我解压到D盘,文件夹命名rclone,此时点击Win+R,然后输入cmd,确定。再输入以下命令:
2、获取token
开始运行——CMD回车
d:
cd rclone
rclone.exe authorize "onedrive"
弹出登录对话框,登录自己的OneDrive
登录成功后会获取到一串Token,保存备用
{“access_token”:————————-472605+08:00″}包括大括号都要复制
linux下载安装rclone(注意保持和windows软件版本保持一致,否则会报错)
本教程只适用Debian/Ubuntu
系统,如果你是CentOS
,请参考:https://rclone.org/install/,安装rclone。挂载方法和下面差不多。
3、linux安装rclone
wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh
4、执行rclone config配置
root@ubuntu-tw:~# rclone config
Current remotes:
Name Type
==== ====
onedrive-Z4050 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> n
name> onedrive
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / 1Fichier
\ "fichier"
2 / Alias for an existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Citrix Sharefile
\ "sharefile"
9 / Dropbox
\ "dropbox"
10 / Encrypt/Decrypt a remote
\ "crypt"
11 / FTP Connection
\ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
13 / Google Drive
\ "drive"
14 / Google Photos
\ "google photos"
15 / Hubic
\ "hubic"
16 / In memory object storage system.
\ "memory"
17 / JottaCloud
\ "jottacloud"
18 / Koofr
\ "koofr"
19 / Local Disk
\ "local"
20 / Mail.ru Cloud
\ "mailru"
21 / Mega
\ "mega"
22 / Microsoft Azure Blob Storage
\ "azureblob"
23 / Microsoft OneDrive
\ "onedrive"
24 / OpenDrive
\ "opendrive"
25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
26 / Pcloud
\ "pcloud"
27 / Put.io
\ "putio"
28 / QingCloud Object Storage
\ "qingstor"
29 / SSH/SFTP Connection
\ "sftp"
30 / Sugarsync
\ "sugarsync"
31 / Transparently chunk/split large files
\ "chunker"
32 / Union merges the contents of several remotes
\ "union"
33 / Webdav
\ "webdav"
34 / Yandex Disk
\ "yandex"
35 / http Connection
\ "http"
36 / premiumize.me
\ "premiumizeme"
Storage> 23
** See help for onedrive backend at: https://rclone.org/onedrive/ **
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
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> n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine (same rclone version recommended) :
rclone authorize "onedrive"
Then paste the result below:
result> {"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IjBqMWx5S0NRdVlMQVJKazh0bHRQYlJCR5vuyKckP6SeyKnWylwQ9gjgDb0f7M520HhavwyFCFv8VrjThZANxwICVL0KHY9vGq67dt5_X7tgbS-c8aLnC5WpOyfjFk99oZk0rcFglDGw5VuKqBHhX5Itbqz-IMgAA","expiry":"2020-03-23T09:47:50.472605+08:00"}
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Type in driveID
\ "driveid"
4 / Type in SiteID
\ "siteid"
5 / Search a Sharepoint site
\ "search"
Your choice> 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!pqedh1cM1ku141LKYzPiZDag1hP5EPNGuhgzFq97e8D9kzUXM2-YQ5xBdH_Nhhx0
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://uijay-my.sharepoint.com/personal/wxj_myoffice_fun/Documents
Is that okay?
y) Yes (default)
n) No
y/n> y
[onedrive]
type = onedrive
token = {"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IjBqMWx5S0NRdVlMQVJKazh0bHRQYlJ7dt5_X7tgbS-c8aLnC5WpOyfjFk99oZk0rcFglDGw5VuKqBHhX5Itbqz-IMgAA","expiry":"2020-03-23T09:47:50.472605+08:00"}
drive_id = b!pqedh1cM1ku141LKYzPiZDag1hP5EPNGuhgzFq97e8D9kzUXM2-YQ5xBdH_Nhhx0
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
==== ====
onedrive 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
5、挂载onedrive(运行命令的时候会卡住,重新再打开一个窗口即可)
rclone mount onedrive:/ /www/onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemondaemon
#daemon后台模式
6、查看挂载是否成功
df-h