获取应用 ID 和密匙
地址:https://portal.azure.cn/,登录完成后按下面步骤进行
1.左侧Azure Active Directory->应用注册->新注册.
2.名称部分:随便写->受支持的账户类型:任何组织目录(任何 Azure AD 目录 - 多租户)中的帐户
—重定向 URI (可选):http://localhost:53682
—注册
3.应用程序(客户端) ID
4.获取密匙:左侧证书和密码—
右侧客户端密码部分:+新客户端密码
说明:自己填写—截止日期:2 年内—添加
5.左侧 API 权限—
添加权限—Microsoft Graph—委托的权限— 搜索并勾选下面 6 个权限:
Files.Read
Files.Read.All
Files.ReadWrite
Files.ReadWrite.All
offline_access
User.Read
到这样,就注册结束了!用记事本记录一下 ID 和密匙(后面用到)
开始挂载
Windows 命令行进入 rclone 所在文件夹,执行命令:
cd /d d:\rclone
rclone authorize onedrive "应用程序(客户端) ID" "客户端密码值" --onedrive-is-21vianet-version=true
之后会跳转到浏览器,登录账号之后返回 Windows 命令行,会返回 token,复制保存下来,后面要用。
1.将 linux 版的解压上传到usr/bin目录(必须此目录).
2.然后给权限 chmod +x /usr/bin/rclone
3.执行 rclone config.
4.就进入了和官方版 rclone 一样的挂载程序,和国际版 onedrive 不同的是:client_id填写应用程序(客户端) ID,client_secret填写客户端密码。is_21vianet_version填true,Edit advanced config 以及 Use auto config 都选 no,下一步粘贴上之前在 Windows 获取的 token,继续按提示完成之后的步骤。
然后
#安装 fuse
yum install fuse
#创建挂载目录,目录叫什么都可以
mkdir -p /home/one
#挂载
rclone mount kieng(在绑定账号时起的名字):/ /home/one(挂载目录)
#后台运行就加一个&
rclone mount kieng(在绑定账号时起的名字):/ /home/one(挂载目录)&
有的会重启之后就会挂载失效.再次运行上面的命令或者自己设置一下开机自启即可.
本文转自:https://blog.kieng.cn/2067.html
以下参考:https://www.vipiu.net/archives/2019/08/02/2172.html
准备
先安装一下基本组件
yum -y install wget unzip screen fuse fuse-devel
配置
接着就输入以下命令进行rclone设置
rclone config
输入命令后
2019/08/02 10:55:49 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,创建一个新的。
然后输入名字,回车
name> onedrive
这个名字随意就行,自己记住就好了
选择需要挂载的网盘
我们今天主要是挂在onedrive,所以这里选择19,根据实际来选择,rclone版本不一样选择也不一样。
下面就是client_id>和client_secret> ,这两项直接回车,不管(如果是世纪互联需要填写)
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>
是否配置高级设置,这里我们直接No,选择n
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
是否使用自动设置,同样直接NO,选择n
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> n
这一步就需要用到我们刚才在win获取到的access_token
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
rclone authorize "onedrive"
Then paste the result below:
result>
这里选择1,onedrive个人版或是商业版
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!tjyPr9WccUytxb9q4bgCz1Z8pnMGbxJCmV651K4oHDgyUnggpbbeTYTa
Chose drive to use:> 0
输入前面的序号就行
下面直接yes,大概的意思是找到这个驱动器,不知道对不对
Found drive 'root' of type 'business', URL: https://dddd290-my.sharepoint.com/personal/info_vipiu_net/Documents
Is that okay?
y) Yes
n) No
y/n> y
然后确认
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
然后退出配置
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>
以上就配置好了,剩下的就是挂载了
挂载
首先创建一个本地文件夹,我创建的是/home/onedrive ,路径可以你自己定, 也就是下面的LocalFolder
mkdir /home/onedrive
挂载为磁盘的命令如下
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate
--allow-other --allow-non-empty --umask 000
如果你和我一样设置的挂载命令是:
rclone mount onedrive: /home/onedrive --allow-other --allow-non-empty --vfs-cache-mode writes
在运行挂载命令后,SSH窗口会出现中断,光标丢失,此时关掉窗口即可。如需另外再挂载网盘,只需要重新连接。
不出问题的情况下,输入
df -h
就可以看到Onedrive成功挂载。
叨叨几句... NOTHING