一、世纪互联 OneDrive 获取 CLIENT_ID 及 CLIENT_SECRET
打开 https://portal.azure.cn/ 登陆并按以下步骤:
回到界面会发现该权限处于未授权状态,我们需要全局管理员点击 代表XXXX授予管理员同意
Files.Read Files.Read.All Files.Read.Selected Files.ReadWrite Files.ReadWrite.All Files.ReadWrite.AppFolder Files.ReadWrite.Selected二、安装配置 Rclone
Rclone 世纪互联版修改地址:兼容世纪互联的 Rclone
预编译兼容世纪互联的 Rclone v1.50.2
Linux 32位 | Linux 64位 | Windows 32位 | Windows 64位
下载解压上传到 /usr/bin 目录,然后
chmod +x /usr/bin/rclone rclone config完整配置过程如下
Microsoft Windows [版本 10.0.17763.316] (c) 2018 Microsoft Corporation。保留所有权利。 C:\Users\user>cd C:\Users\user\Desktop\rclone-v1.50.2-windows-amd64-21vianet C:\Users\user\Desktop\rclone-v1.50.2-windows-amd64-21vianet>rclone config 2020/02/01 13:46:21 NOTICE: Config file "C:\\Users\\user\\.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 name> onedrive_cn 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 / 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" Storage> 22 ** 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> 6b57cb03-3791-4823-9ce9-5dd027e***** Microsoft App Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret> l05:IBoAAVh4]Y]4M_?9lgw-L8****** OneDrive operated by 21Vianet (世纪互联). Enter a boolean value (true or false). Press Enter for the default ("false"). is_21vianet_version> true Edit advanced config? (y/n) y) Yes n) No y/n> y Chunk size to upload files with - must be multiple of 320k (327,680 bytes). Above this size files will be chunked - must be multiple of 320k (327,680 bytes). Note that the chunks will be buffered into memory. Enter a size with suffix k,M,G,T. Press Enter for the default ("10M"). chunk_size> 10M The ID of the drive to use Enter a string value. Press Enter for the default (""). drive_id> The type of the drive ( personal | business | documentLibrary ) Enter a string value. Press Enter for the default (""). drive_type> business Set to make OneNote files show up in directory listings. By default rclone will hide OneNote files in directory listings because operations like "Open" and "Update" won't work on them. But this behaviour may also prevent you from deleting them. If you want to delete OneNote files or otherwise want them to show up in directory listing, set this option. Enter a boolean value (true or false). Press Enter for the default ("false"). expose_onenote_files> Remote config Make sure your Redirect URL is set to "http://localhost:53682/" in your custom 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 If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=3-n1fmI2XA7QsjnhQAjoQw Log in and authorize rclone for access 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 Found 1 drives, please select the one you want to use: 0: OneDrive (business) id=b!Yb3jWYP2_EOgiOjYxlsv4iz1Y8ZSfhlEm48kp98Ew0Dzv4TUrSwSSK1sL5j***** Chose drive to use:> 0 Found drive 'root' of type 'business', URL: https://*****-my.sharepoint.cn/personal/***_****_partner_onmschina_cn/Documents Is that okay? y) Yes n) No y/n> y -------------------- [onedrive_cn] type = onedrive client_id = 6b57cb03-3791-4823-9ce9-5dd027e***** client_secret = l05:IBoAAVh4]Y]4M_?9lgw-L8****** is_21vianet_version = true chunk_size = 10M drive_type = business token = {"access_token":"eyJ0eXAiOiJKV1Q********BtBs2OM8B1Euv7SAA","expiry":"2020-02-01T14:50:32.8151941+08:00"} drive_id = b!Yb3jWYP2_EOgiOjYxlsv4iz1Y8****************UrSwSSK1sL5jmrG0I -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y Current remotes: Name Type ==== ==== onedrive_cn 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配置文件C:\Users\user\.config\rclone\rclone.conf格式如下
[onedrive_cn] type = onedrive client_id = 6b57cb03-3791-4823-9ce9-5dd027e***** client_secret = l05:IBoAAVh4]Y]4M_?9lgw-L8****** is_21vianet_version = true chunk_size = 10M drive_type = business token = {"access_token":"eyJ0eXAiOiJKV1Q********BtBs2OM8B1Euv7SAA","expiry":"2020-02-01T14:50:32.8151941+08:00"} drive_id = b!Yb3jWYP2_EOgiOjYxlsv4iz1Y8****************UrSwSSK1sL5jmrG0I挂载
apt -y update && apt install fuse挂载命令:
rclone mount onedrive:/ /mnt/ --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000后台挂载命令:
nohup rclone mount onedrive:/ /mnt --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 >/dev/null 2>&1 &卸载命令:
fusermount -qzu LocalFolder onedriveRclone 开机启动(脚本来自:Rat’s Blog,二次修改支持多网盘挂载)
nano /etc/init.d/rcloned文本内容如下
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH NAME_BIN="rclone" ### BEGIN INIT INFO # Provides: rclone # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start rclone at boot time # Description: Enable rclone by daemon. ### END INIT INFO NAME="" #rclone name名 REMOTE='' #远程文件夹 LOCAL='' #挂在地址 NAME_1="" REMOTE_1='' LOCAL_1='' Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m" Info="${Green_font_prefix}[信息]${Font_color_suffix}" Error="${Red_font_prefix}[错误]${Font_color_suffix}" RETVAL=0 check_running(){ PID="$(ps -C $NAME_BIN -o pid= |head -n1 |grep -o '[0-9]\{1,\}')" if [[ ! -z ${PID} ]]; then return 0 else return 1 fi } do_start(){ check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN (PID ${PID}) 正在运行..." && exit 0 else fusermount -zuq $LOCAL >/dev/null 2>&1 mkdir -p $LOCAL /usr/bin/rclone mount $NAME:$REMOTE $LOCAL --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 >/dev/null 2>&1 & sleep 2s fusermount -zuq $LOCAL_1 >/dev/null 2>&1 mkdir -p $LOCAL_1 /usr/bin/rclone mount $NAME_1:$REMOTE_1 $LOCAL_1 --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 >/dev/null 2>&1 & check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN 启动成功 !" else echo -e "${Error} $NAME_BIN 启动失败 !" fi fi } do_stop(){ check_running if [[ $? -eq 0 ]]; then kill -9 ${PID} RETVAL=$? if [[ $RETVAL -eq 0 ]]; then echo -e "${Info} $NAME_BIN 停止成功 !" else echo -e "${Error} $NAME_BIN 停止失败 !" fi else echo -e "${Info} $NAME_BIN 未运行" RETVAL=1 fi fusermount -zuq $LOCAL >/dev/null 2>&1 fusermount -zuq $LOCAL1 >/dev/null 2>&1 } do_status(){ check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN (PID $(echo ${PID})) 正在运行..." else echo -e "${Info} $NAME_BIN 未运行 !" RETVAL=1 fi } do_restart(){ do_stop do_start } case "$1" in start|stop|restart|status) do_$1 ;; *) echo "使用方法: $0 { start | stop | restart | status }" RETVAL=1 ;; esac exit $RETVAL操作命令
chmod +x /etc/init.d/rcloned /etc/init.d/rcloned start /etc/init.d/rcloned stop转自:https://567899.xyz/rclone-onedrive-cn.html
推荐站内搜索:域名服务器是什么、美国免费主机、ip购买、香港ip代理、主机服务器租用、免费国际域名云服务器、独立ip虚拟主机、域名 查询、免费服务器永久使用、