使用rcwin7下挂载rclonelone挂载onedrive Ubuntu上使用rclone挂载OneDrive网盘
番茄系统家园 · 2021-07-08 20:34:43

客户端授权
在本地电脑上下载,下载后将复制到C:\\
运行CMD,输入
浏览器会自动打开,登入进行授权,浏览器提示!,返回cmd,获取
复制保存好token
注意:如果是WIN7,CMD生成的token是有回车的,需要将回车删除
服务器配置
curlhttps://rclone.org/install.sh|sudobash
开始配置:rcloneconfig
n)Newremotes)Setconfigurationpasswordq)Quitconfign/s/q`n`name`od`Typeofstoragetoconfigure.Enterastringvalue.PressEnterforthedefault().Chooseanumberfrombelow,ortypeinyourownvalue19/MicrosoftOneDrive\onedriveStorage`19`**Seehelpforonedrivebackendat:https://rclone.org/onedrive/**MicrosoftAppClientIdLeaveblanknormally.Enterastringvalue.PressEnterforthedefault().client_id`直接回车`client_secret`直接回车`Editadvancedconfig?(y/n)y)Yesn)Noy/n`n`RemoteconfigUseautoconfig?SayYifnotsureSayNifyouareworkingonaremoteorheadlessmachiney)Yesn)Noy/n`n`Forthistowork,youwillneedrcloneavailableonamachinethathasawebbrowseravailable.Executethefollowingonyourmachine:rcloneauthorizeonedriveThenpastetheresultbelow:result`输入前面获取token`Chooseanumberfrombelow,ortypeinanexistingvalue1/OneDrivePersonalorBusiness\onedriveYourchoice`1`Found1drives,pleaseselecttheoneyouwanttouse:0:(personal)id=aba1021fbca78159Chosedrivetouse:`0`Founddrive'root'oftype'personal',URL:https://onedrive.live.com/?cid=aba1021fbca78159Isthatokay?y)Yesn)Noy/n`y`--------------------[qfbmtc]type=onedrivetoken={access_token:xxx}drive_id=aba1021fbca78159drive_type=personal--------------------y)YesthisisOKe)Editthisremoted)Deletethisremotey/e/d`y`Currentremotes:NameType========qfbmtconedrivee)Editexistingremoten)Newremoted)Deleteremoter)Renameremotec)Copyremotes)Setconfigurationpasswordq)Quitconfige/n/d/r/c/s/q`q`
挂载
yuminstallfusemkdir/root/OneDrive#新建本地文件夹rclonemountDriveName:FolderLocalFolder--copy-links--no-gzip-encoding--no-check-certificate--allow-other--allow-non-empty--umask000
DriveName
为初始化配置填的name,Folder为OneDrive里的文件夹,格式为/XX/XXX,LocalFolder为VPS上的本地文件夹。
如果报错,需要安装fuse:yuminstallfuse
如需挂载同一个onedrive的不同目录,配置好后执行rcloneconfig可以进行复制,name不能相同
卸载:fusermount-qzuLocalFolder
开机启动
使用Systemctl守护进程
vi/etc/systemd/system/od.service
[Unit]Description=OneDriveAssertPathIsDirectory=LocalFolderAfter=network-online.target[Service]Type=simpleExecStart=/usr/bin/rclonemountod:/Public/root/OneDrive--copy-links--no-gzip-encoding--no-check-certificate--allow-other--allow-non-empty--umask000ExecStop=/bin/fusermount-qzu/root/OneDriveRestart=on-abort[Install]WantedBy=default.target
相关命令:
自启:systemctlenableod
启动:systemctlstartod
停止:systemctlstopod
禁用:systemctldisableod
删除:rm-rf/etc/systemd/system/od.service
执行df-h可以查看到挂载的onedrive
GoogleDrive

