众所周知,OneDrive可以提供很大的储存空间,这篇文章主要卸了linux如何使用rclone挂载OneDrive

首先,安装rclone,具体命令如下

curl https://rclone.org/install.sh | sudo bash

安装完成后执行rclone config
输入n新建一个drive并给它七个名字
新建盘
会给出一个列表

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 / JottaCloud
   \ "jottacloud"
17 / Koofr
   \ "koofr"
18 / Local Disk
   \ "local"
19 / Mail.ru Cloud
   \ "mailru"
20 / Mega
   \ "mega"
21 / Microsoft Azure Blob Storage
   \ "azureblob"
22 / Microsoft OneDrive
   \ "onedrive"
23 / OpenDrive
   \ "opendrive"
24 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
25 / Pcloud
   \ "pcloud"
26 / Put.io
   \ "putio"
27 / QingCloud Object Storage
   \ "qingstor"
28 / SSH/SFTP Connection
   \ "sftp"
29 / Transparently chunk/split large files
   \ "chunker"
30 / Union merges the contents of several remotes
   \ "union"
31 / Webdav
   \ "webdav"
32 / Yandex Disk
   \ "yandex"
33 / http Connection
   \ "http"
34 / premiumize.me
   \ "premiumizeme"

输入22即OneDrive,开始配置
之后client_idclient_secret直接回车就好
出现下面的内容
输入n
直接n
接下来,它会问你使用哪种方式授权,如果你的服务器没有安装桌面或是你正在使用ssh,那么选择n,如图
输入n

在一台可以使用桌面的计算机上安装rclone后执行rclone authorize "onedrive"
此时,浏览器会打开一个窗口,跳转到微软的登录页面,输入OneDrive的账号密码就可以了。
回到有桌面的rclone,这时窗口就会出现授权token(如果没有,等一会会应该就会有了)
把token全部复制下来(包括{})
粘贴到远程服务器,
token
选择1
选择1
就配置完成了。
然后在ssh中执行

rclone mount 配置时输入的名称:/远程目录 /挂载目录 --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

到这里,就挂载成功了,快去体验吧!


Tip:
执行挂载命令后,不会出现下一行命令行提示符,并且ssh关闭连接后就会停止挂载
解决方案是:
screen -S rclone
在新的screen会话中执行挂载命令后Ctrl + Alt + A + D退出会话,挂载就不会停止(除非关机)
如需开机启动,将rclone作为服务启动

最后修改:2020 年 03 月 17 日
如果觉得我的文章对你有用,请随意赞赏