Rclone可以掛載OneDrive/Google Drive/Amazon Drive等雲存儲,同時支持全平台,意味着您可以在Windows、Mac OS、Linux上進行使用。這篇文章主要分享CentOS使用Rclone掛載OneDrive的過程,其它系統或者掛載其它網盤原理和方法大致相同。
在Centos平台安裝Rclone
curl https://rclone.org/install.sh | sudo bash
配置Rclone
#打開配置界面
rclone config
此時顯示
[harroy@harroy ~]$ rclone config
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> n
#輸入n,表示新建連接
#-------------------------------------------------------------------------
name> onedrive
#為你的連接命名,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 / Tardigrade Decentralized Cloud Storage
\ "tardigrade"
32 / Transparently chunk/split large files
\ "chunker"
33 / Union merges the contents of several upstream fs
\ "union"
34 / Webdav
\ "webdav"
35 / Yandex Disk
\ "yandex"
36 / http Connection
\ "http"
37 / premiumize.me
\ "premiumizeme"
38 / seafile
\ "seafile"
Storage> 23
#選擇你想要掛載的網盤,選擇onedrive的編號即可
#-------------------------------------------------------------------------
** 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>
#直接回車即可
#-------------------------------------------------------------------------
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>
#直接回車即可
#-------------------------------------------------------------------------
"If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=SJZW8XROgC6H6p9VnN63HQ
Log in and authorize rclone for access"
Waiting for code...
#復制該連接到瀏覽器,輸入帳號密碼並進行授權,然后回到終端即可看到下面信息
#-------------------------------------------------------------------------
Got code
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
#選擇onedrive相關編號即可
#-------------------------------------------------------------------------
Found 1 drives, please select the one you want to use:
0: (personal) id=575ada71ced881d6
Chose drive to use:> 0
#將提示的序號0輸入即可
#-------------------------------------------------------------------------
Found drive 'root' of type 'personal', URL: https://onedrive.live.com/?cid=575ada71ced881d6
Is that okay?
y) Yes (default)
n) No
y/n>
#直接回車即可
#-------------------------------------------------------------------------
--------------------
[test]
type = onedrive
token = {'Your token'} #終端中出現的token會很長,我這里簡化了
drive_id = 575ada71ced881d6
drive_type = personal
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
#直接回車即可
#-------------------------------------------------------------------------
到這一步Rclone的配置就已經完成。在使用之前需要做一些准備工作,建立掛載的文件夾。
#沒有安裝掛載軟件的需要先安裝掛載軟件
yum -y install fuse
#創建掛載目錄,請在<User name>輸入你的用戶名
mkdir -p /home/<User name>/onedrive
掛載onedrive
最后直接掛載onedrive即可使用,你可以每次使用前輸入該命令,也可以將該命令存為Bash腳本,或者將該命令配置到啟動項中。
rclone mount onedrive:/ /home/<User name>/onedrive