由于服务器没有网页,需要使用电脑辅助获取 access_token,二者版本要保持一致。默认使用官方 API,由于官方 API 为所有用户共享,速度可能容易被限制,如果要求较高可以官方参照教程去 Microsoft Azure 自己注册应用并设置 API 获取相应的 client_id 和 client_secret 以减少限制。
root@debian:~# rclone config 2024/06/26 18:15:45 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults No remotes found, make a new one? n) New remote s) Set configuration password q) Quit config n/s/q> n # 输入 n,新建远程连接
Enter name for new remote. 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 S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, DigitalOcean, Dreamhost, GCS, HuaweiOBS, IBMCOS, IDrive, IONOS, LyveCloud, Leviia, Liara, Linode, Magalu, Minio, Netease, Petabox, RackCorp, Rclone, Scaleway, SeaweedFS, StackPath, Storj, Synology, TencentCOS, Wasabi, Qiniu and others \ (s3) 5 / Backblaze B2 \ (b2) 6 / Better checksums for other remotes \ (hasher) 7 / Box \ (box) 8 / Cache a remote \ (cache) 9 / Citrix Sharefile \ (sharefile) 10 / Combine several remotes into one \ (combine) 11 / Compress a remote \ (compress) 12 / Dropbox \ (dropbox) 13 / Encrypt/Decrypt a remote \ (crypt) 14 / Enterprise File Fabric \ (filefabric) 15 / FTP \ (ftp) 16 / Google Cloud Storage (this is not Google Drive) \ (google cloud storage) 17 / Google Drive \ (drive) 18 / Google Photos \ (google photos) 19 / HTTP \ (http) 20 / Hadoop distributed file system \ (hdfs) 21 / HiDrive \ (hidrive) 22 / ImageKit.io \ (imagekit) 23 / In memory object storage system. \ (memory) 24 / Internet Archive \ (internetarchive) 25 / Jottacloud \ (jottacloud) 26 / Koofr, Digi Storage and other Koofr-compatible storage providers \ (koofr) 27 / Linkbox \ (linkbox) 28 / Local Disk \ (local) 29 / Mail.ru Cloud \ (mailru) 30 / Mega \ (mega) 31 / Microsoft Azure Blob Storage \ (azureblob) 32 / Microsoft Azure Files \ (azurefiles) 33 / Microsoft OneDrive \ (onedrive) 34 / OpenDrive \ (opendrive) 35 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH) \ (swift) 36 / Oracle Cloud Infrastructure Object Storage \ (oracleobjectstorage) 37 / Pcloud \ (pcloud) 38 / PikPak \ (pikpak) 39 / Proton Drive \ (protondrive) 40 / Put.io \ (putio) 41 / QingCloud Object Storage \ (qingstor) 42 / Quatrix by Maytech \ (quatrix) 43 / SMB / CIFS \ (smb) 44 / SSH/SFTP \ (sftp) 45 / Sia Decentralized Cloud \ (sia) 46 / Storj Decentralized Cloud Storage \ (storj) 47 / Sugarsync \ (sugarsync) 48 / Transparently chunk/split large files \ (chunker) 49 / Uloz.to \ (ulozto) 50 / Union merges the contents of several upstream fs \ (union) 51 / Uptobox \ (uptobox) 52 / WebDAV \ (webdav) 53 / Yandex Disk \ (yandex) 54 / Zoho \ (zoho) 55 / premiumize.me \ (premiumizeme) 56 / seafile \ (seafile) Storage> 33 # 找到 Microsoft OneDrive 的序号,我这里的版本是 33
Option client_id. OAuth Client Id. Leave blank normally. Enter a value. Press Enter to leave empty. client_id> # 一般留空,直接回车,如果你需要同步大量文件可以自己去 Microsoft Azure 注册应用程序并设置 API,而不使用 rclone 的 API 减少限制
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 value of type string. 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 Vnet Group in China \ (cn) region> 1 # 选择你的 OneDrive 区域
Edit advanced config? y) Yes n) No (default) y/n> n # 输入 n,不进行高级设置
Use web browser to automatically authenticate rclone with remote? * Say Y if the machine running rclone has a web browser you can use * Say N if running rclone on a (remote) machine without web browser access If not sure try Y. If Y failed, try N.
y) Yes (default) n) No y/n> 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" "xxxx" # 复制这段内容,用电脑上相同版本的 rclone 去获取 token Then paste the result. Enter a value. config_token> xxxx # 输入电脑辅助获取的 token
Option config_type. Type of connection Choose a number from below, or type in an existing value of type string. 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 # 输入你的 OneDrive 类型
Option config_driveid. Select drive you want to use Choose a number from below, or type in your own value of type string. Press Enter for the default (xxxx). 1 / (personal) \ (xxxx) config_driveid> 1 # 输入 1 即可
Drive OK?
Found drive "root" of type "personal" URL: https://onedrive.live.com/?cid=xxxx
y) Yes (default) n) No y/n> y # 输入 y 确认
Configuration complete. Options: - type: onedrive - client_id: xxxx - client_secret: xxxx - token: {"access_token":"xxxx"} - drive_id: xxxx - drive_type: personal Keep this "onedrive" remote? y) Yes this is OK (default) 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 退出配置