利用OneDrive 扩容你的VPS (Rclone)
视频教程:
https://youtu.be/rE15Ug6evOM
安装Rclone
curl https://rclone.org/install.sh | sudo bash
安装rinet
apt-get install rinetd
配置rinet
nano /etc/rinetd.conf
修改配置文件如下
0.0.0.0 9080 127.0.0.1 53682
重启rinetd
systemctl restart rinetd
开始配置Rclone:
rclone config
root@raspberrypi:/OneDrive# rclone config
No remotes found – make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n <———— 选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 / A stackable unification remote, which can appear to merge the contents of several remotes
\ “union”
2 / Alias for a existing remote
\ “alias”
3 / Amazon Drive
\ “amazon cloud drive”
4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
\ “s3”
5 / Backblaze B2
\ “b2”
6 / Box
\ “box”
7 / Cache a remote
\ “cache”
8 / Dropbox
\ “dropbox”
9 / Encrypt/Decrypt a remote
\ “crypt”
10 / FTP Connection
\ “ftp”
11 / Google Cloud Storage (this is not Google Drive)
\ “google cloud storage”
12 / Google Drive
\ “drive”
13 / Hubic
\ “hubic”
14 / JottaCloud
\ “jottacloud”
15 / Local Disk
\ “local”
16 / Mega
\ “mega”
17 / Microsoft Azure Blob Storage
\ “azureblob”
18 / Microsoft OneDrive
\ “onedrive”
19 / OpenDrive
\ “opendrive”
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ “swift”
21 / Pcloud
\ “pcloud”
22 / QingCloud Object Storage
\ “qingstor”
23 / SSH/SFTP Connection
\ “sftp”
24 / Webdav
\ “webdav”
25 / Yandex Disk
\ “yandex”
26 / http Connection
\ “http”
Storage> 18 <———— 选18 这个是你要选择的网盘类型,这里18是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
y/n> 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
n) No
y/n> y <———— 选y
If your browser doesn’t open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code…
当出现上面的字样,请打开浏览器访问你的VPS地址+端口号9080完成授权
例如:http://111.111.111.111:9080/auth
根据提示完成授权后跳转网址为类似下面的样子,会显示无法打开,修改一下服务器地址完成验证:
修改前:
http://localhost/?code=Mb40efd29-46d6-735a-77c9-e0bbubc932ea&state=cbd535805a065efb2507b3d08a46da63
修改后:
http://111.111.111.111:9080/?code=Mb40efd29-46d6-735a-77c9-e0bbubc932ea&state=cbd535805a065efb2507b3d08a46da63
回车会有一个网页提示成功,再次回到SSH界面
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 <———— 选1
Found 1 drives, please select the one you want to use:
0: (personal) id=1043704bc734301f
Chose drive to use:> 0 <———— 选0
Found drive ‘root’ of type ‘personal’, URL: https://onedrive.live.com/?cid=1043704bc734301f
Is that okay?
y) Yes
n) No
y/n> y <———— 选y
——————–
[OneDrive]
type = onedrive
token = {“access_token”:”EwBoA8l6BAAURSN/FHlDW5xN74t6GzbtsBBeBUYAAQhF4YCEsN8EanOsVcJNddrLt2zp2HjOfIRpv8hVMA2X+1obyFiUDkU/uL/MC2QzW3vG6T6H/5/l8piyEWNUxQNm+gp2O/Fo7eS89HSnqTPPAwxPXrbZTzcl7UMNUp0pJ71yXfECvqsOgAacdlJTXH7IYhjjNPwTeRFj8wl+QbLc8B0LSbFctwU2XJbdL5Ug8Nbk6E8NSnnmgzA6SFRcreYozEM4Vt13T+iIAZ7Z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*XU!FLmatdRrhLa5jdYFRF2aK10V15H5RcuzN1r!HSzbXisUUQL6YIhn0e3gwTG2yk!m8exbdVqnsrOB6PTGfYEnk4LlO9EEEp6a5TTzd5!2obXSAnvCqi70fHWV6C*6fE*2zOylDboqF7CtF8xbAHceTu2JVwKNUt5eq0Uhw6tJuw2sj7OcQie6BjoanTL0GvuZH2C3JYm2Z0Q5jMPiBrcFGVqWLeSGAGiMEI8Y0P4pDg7I58VGx!QhpRd”,”expiry”:”2019-01-21T12:00:07.780005378+08:00″}
drive_id = 1043704bc734301f
drive_type = personal
——————–
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y <———— 选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 <———— 选q退出配置
至此配置完成,下面把这个网盘挂载为本机目录:
本机新建一个目录作为挂载目录 /OneDrive
OneDrive 里新建一个目录用来挂载 这里用 Rclone为例
/usr/bin/rclone mount OneDrive:/Rclone /OneDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --vfs-cache-mode minimal &
至此您的OneDrive下面的Rclone文件夹就挂载到你的VPS /OneDrive 目录下了,你可以像操作本机目录一样操作这个目录了。
接下来讲解如何让系统重启后自动挂载这个目录
nano /usr/lib/systemd/system/rclone.service
粘贴下面内容 [Unit] Description=rclone [Service] User=root ExecStart=/usr/bin/rclone mount OneDrive:/Rclone /OneDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --vfs-cache-mode minimal & Restart=on-abort [Install] WantedBy=multi-user.target 执行下面3条命令后,如果没有报错,恭喜你成功了!
systemctl daemon-reload
systemctl enable rclone systemctl start rclone
完全按照你这个配置的,到跳转至http://111.111.111.111:9080/?code=Mb40efd29-46d6-735a-77c9-e0bbubc932ea&state=cbd535805a065efb2507b3d08a46da63这一步后,出现Failure!
Error: Auth Error
Description: No code found returned by remote server.
看视频里的操作了吗?
好像是学校的edu’邮箱域名未托管,没有管理员