赞
踩
普通VPS的硬盘容量作为网盘还远远不足,因此我比较喜欢在个人服务器上挂载Onedrive的E5开发者版来作为网盘使用(国际版的onedrive也不会和谐某些资源,很舒服)
宝塔应用商店->PHP->安装扩展
处,安装smbclient扩展 curl https://rclone.org/install.sh | bash
rclone authorize "onedrive"
,登录你的开发者/教育版微软账户,登录成功后回到命令行,复制输出内容,并保存。名称 随意填写
账户类型选择 任何组织目录(任何 Azure AD 目录 - 多租户)中的帐户和个人 Microsoft帐户(例如,Skype、Xbox)
重定向 URI 平台选择 Web ,URI 回到你的nextcloud页面,确保当前页面为外部存储的插件页面,复制当前网页地址并填入
点击注册
Onedrive页面->概述->应用程序(客户端) ID
并保存值
并保存添加权限->Microsoft Graph->委托的权限
,并在搜索处搜索并勾选 User.Read | Files.ReadWrite.All | offline_access
三个权限,点击添加rclone config
进行配置,配置有点长,不作解释,自行观看No remotes found, make a new one? n) New remote s) Set configuration password q) Quit config n/s/q> n name> onedrive Option Storage. Type of storage to configure. Choose a number from below, or type in your own value. 1 / 1Fichier \ (fichier) 2 / Akamai NetStorage \ (netstorage) 3 / Alias for an existing remote \ (alias) 4 / Amazon Drive \ (amazon cloud drive) 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Digital Ocean, Dreamhost, IBM COS, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi \ (s3) 6 / Backblaze B2 \ (b2) 7 / Better checksums for other remotes \ (hasher) 8 / Box \ (box) 9 / Cache a remote \ (cache) 10 / Citrix Sharefile \ (sharefile) 11 / Compress a remote \ (compress) 12 / Dropbox \ (dropbox) 13 / Encrypt/Decrypt a remote \ (crypt) 14 / Enterprise File Fabric \ (filefabric) 15 / FTP Connection \ (ftp) 16 / Google Cloud Storage (this is not Google Drive) \ (google cloud storage) 17 / Google Drive \ (drive) 18 / Google Photos \ (google photos) 19 / Hadoop distributed file system \ (hdfs) 20 / Hubic \ (hubic) 21 / In memory object storage system. \ (memory) 22 / Jottacloud \ (jottacloud) 23 / Koofr, Digi Storage and other Koofr-compatible storage providers \ (koofr) 24 / Local Disk \ (local) 25 / Mail.ru Cloud \ (mailru) 26 / Mega \ (mega) 27 / Microsoft Azure Blob Storage \ (azureblob) 28 / Microsoft OneDrive \ (onedrive) 29 / OpenDrive \ (opendrive) 30 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ (swift) 31 / Pcloud \ (pcloud) 32 / Put.io \ (putio) 33 / QingCloud Object Storage \ (qingstor) 34 / SSH/SFTP Connection \ (sftp) 35 / Sia Decentralized Cloud \ (sia) 36 / Storj Decentralized Cloud Storage \ (storj) 37 / Sugarsync \ (sugarsync) 38 / Transparently chunk/split large files \ (chunker) 39 / Union merges the contents of several upstream fs \ (union) 40 / Uptobox \ (uptobox) 41 / Webdav \ (webdav) 42 / Yandex Disk \ (yandex) 43 / Zoho \ (zoho) 44 / http Connection \ (http) 45 / premiumize.me \ (premiumizeme) 46 / seafile \ (seafile) Storage> 28 Option client_id. OAuth Client Id. Leave blank normally. Enter a value. Press Enter to leave empty. client_id> 之前保存的应用程序ID Option client_secret. OAuth Client Secret. Leave blank normally. Enter a value. Press Enter to leave empty. client_secret> 之前保存的密码值 Option region. Choose national cloud region for OneDrive. Choose a number from below, or type in your own string value. Press Enter for the default (global). 1 / Microsoft Cloud Global \ (global) 2 / Microsoft Cloud for US Government \ (us) 3 / Microsoft Cloud Germany \ (de) 4 / Azure and Office 365 operated by 21Vianet in China \ (cn) region> 1 Edit advanced config? y) Yes n) No (default) y/n> n 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> n Option config_token. For this to work, you will need rclone available on a machine that has a web browser available. For more help and alternate methods see: https://rclone.org/remote_setup/ Execute the following on the machine with the web browser (same rclone version recommended): rclone authorize "onedrive" "eyJjbGllbnRfaWQiOiIzODMxM2QzYS1lOTk5LTRlMjYtOTQ5Mi0wYjE0ZmJhYjg2NGYiLCJjbGllbnRfc2VjcmV0IjoieGZJOFF+elVhbVFQRHd4Qm10eko4aGhaSGc1LTFNYjRrakFKdmRnQSJ9" Then paste the result. Enter a value. config_token> 刚刚保存的token Option config_type. Type of connection Choose a number from below, or type in an existing string value. Press Enter for the default (onedrive). 1 / OneDrive Personal or Business \ (onedrive) 2 / Root Sharepoint site \ (sharepoint) / Sharepoint site name or URL 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite \ (url) 4 / Search for a Sharepoint site \ (search) 5 / Type in driveID (advanced) \ (driveid) 6 / Type in SiteID (advanced) \ (siteid) / Sharepoint server-relative path (advanced) 7 | E.g. /teams/hr \ (path) config_type> 1 Drive OK? Found drive "root" of type "business" URL: https://pantwooosix-my.sharepoint.com/personal/twosix_pantwooosix_onmicrosoft_com/Documents y) Yes (default) n) No y/n> y -------------------- [onedrive] type = onedrive client_id = *** client_secret = *** token = *** drive_id = *** drive_type = business -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> 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
rclone mount onedrive:/nextcloud /data/lius1999 --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --vfs-cache-mode writes --umask 000
,若无报错则挂载成功(会卡住),此时ctrl+c返回。command="刚才挂载的命令"
cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
After=network-online.target
[Service]
Type=simple
ExecStart=${command}
Restart=on-abort
User=root
[Install]
WantedBy=default.target
EOF
再输入
systemctl enable rclone.service
systemctl start rclone.service
此时输入 df -h
即可查看是否挂载成功。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。