Centos 掛載 Onedrive 方法——利用 Rclone
阿新 • • 發佈:2020-08-26
Centos 掛載 Onedrive 方法——利用 Rclone
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