1.首先需要自己注册申请OneDrive的网盘

2.安装rclone模块挂载网盘

rclone没有ubuntu的安装库,所以一般状况下apt-get 无法直接安装,需要下载从https://rclone.org/downloads/下载

wget https://downloads.rclone.org/v1.46/rclone-v1.46-linux-amd64.debdpkg -i rclone-v1.46-linux-amd64.deb

3.配置OneDrive,允许外部api访问磁盘

Getting your own Client ID and Key

rclone uses a pair of Client ID and Key shared by all rclone users when performing requests by default. If you are having problems with them (E.g., seeing a lot of throttling), you can get your own Client ID and Key by following the steps below:

  1. Open https://apps.dev.microsoft.com/#/appList, then click Add an app (Choose Converged applications if applicable)
  2. Enter a name for your app, and click continue. Copy and keep the Application Id under the app name for later use.
  3. Under section Application Secrets, click Generate New Password. Copy and keep that password for later use.
  4. Under section Platforms, click Add platform, then Web. Enter http://localhost:53682/ in Redirect URLs.
  5. Under section Microsoft Graph PermissionsAdd these delegated permissionsFiles.ReadFiles.ReadWriteFiles.Read.AllFiles.ReadWrite.Alloffline_accessUser.Read.
  6. Scroll to the bottom and click Save.

4.配置rclone

rclone config
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> n    <------选择n
name> remote        <------挂载磁盘取名
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
...
17 / Microsoft OneDrive\ "onedrive"
...
Storage> 17         <------选择网盘类型
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>      <------直接留空回车
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n              <------选n,放弃手动配置
Remote 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              <------选y,自动配置令牌
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code            <------此处会重定向到microsoft的登录界面,登录onedrive账号,确认授权因为需要web访问,所以需要开启vnc操作,单纯ssh无法实现
Choose a number from below, or type in an existing value1 / OneDrive Personal or Business\ "onedrive"2 / Sharepoint site\ "sharepoint"3 / Type in driveID\ "driveid"4 / Type in SiteID\ "siteid"5 / Search a Sharepoint site\ "search"
Your choice> 1      <------确认onedrive类型,一般是1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!Eqwertyuiopasdfghjklzxcvbnm-7mnbvcxzlkjhgfdsapoiuytrewqk
Chose drive to use:> 0     <------选择使用的磁盘,如果有多个
Found drive 'root' of type 'business', URL: https://org-my.sharepoint.com/personal/you/Documents
Is that okay?
y) Yes
n) No
y/n> y                     <------选y
--------------------
[remote]
type = onedrive
token = {"access_token":"youraccesstoken","token_type":"Bearer","refresh_token":"yourrefreshtoken","expiry":"2018-08-26T22:39:52.486512262+08:00"}
drive_id = b!Eqwertyuiopasdfghjklzxcvbnm-7mnbvcxzlkjhgfdsapoiuytrewqk
drive_type = business
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y                  <------大功告成

5.挂载为本地磁盘 (rclone mount 被标注为实验性的功能,文件上传下载没有rclone copy 好用)

rclone mount YourDiskName:DiskDirectory /MountPoint --daemon --copy-links --no-gzip-encoding --no-check-certificate

YourDiskName:前面取的磁盘名称

DiskDirectory:OneDrive里面的目录名

MountPoint:本地挂载点

--daemon:挂载为后台程序,不加mount程序不能退出

root@VM-0-8-ubuntu:~# df -h
Filesystem       Size  Used Avail Use% Mounted on
udev             410M     0  410M   0% /dev
tmpfs             87M   12M   75M  14% /run
/dev/vda1         50G   35G   13G  74% /
tmpfs            433M  132K  432M   1% /dev/shm
tmpfs            5.0M     0  5.0M   0% /run/lock
tmpfs            433M     0  433M   0% /sys/fs/cgroup
tmpfs             87M   16K   87M   1% /run/user/117
tmpfs             87M     0   87M   0% /run/user/500
YourDiskName:DiskDirectory  5.0T   27G  5.0T   1% /MountPoint

6.访问控制

OneDrive使用ip段总结:

40.126.12.0/24

TCP:443

13.107.136.0/24

TCP:443

20.190.140.0/24

TCP:443

有需要配置防火墙的可能需要

总结 :

本文知识90%从网上免费获取,总结实践后共享给大家。知识都产权保护,大家都玩球啊(视觉中国可以去死了)。OneDrive速度不错,国内访问上传下载基本都有2m/s

OneDrive 挂载为本地磁盘Ubuntu相关推荐

  1. win10下使用Rclone将OneDrive映射到本地磁盘教程(开机自动挂载)

    win10下使用Rclone将OneDrive映射到本地磁盘教程(开机自动挂载) 下载rclone,winfsp和Git bash Rclone. Winfsp. 和 [Git bash](https ...

  2. 【软件教程】如何将夸克网盘挂载为本地磁盘【Docker+AList+RaiDrive】

    需要准备的软件 quark网盘网页端.(https://pan.quark.cn/) Docker Desktop.(https://www.docker.com/) RaiDrive.(https: ...

  3. 申请onedrive api并使用rclone将其挂载为本地磁盘

    使用edu邮箱注册的微软账号自带1TB云盘空间,我们可以利用rclone将它挂载到linux服务器,作为本地磁盘使用. rclone内置访问onedrive的api,但是共用人数过多可能会被限速导致无 ...

  4. 使用alist连接百度网盘和阿里云盘挂载到本地磁盘

    1.下载alist软件 alist软件下载地址:https://github.com/alist-org/alist 跳转后,找到对应的windows版本 2 .下载后解压,并启动服务 注意:alis ...

  5. onedrive 添加到本地硬盘_Windows平台下使用 Rclone 挂载 OneDrive 为本地硬盘

    Rclone (rsync for cloud storage) 是一个命令行程序,用于同步文件和目录,支持常见的 Amazon Drive .Google Drive .OneDrive .Drop ...

  6. Alist挂载本地磁盘

    Alist挂载本地磁盘 部署alist请看教程[alist部署] 地址:阿里云盘分享 登录alist进入后台管理,点击[存储],再点击右侧的[添加] 在[驱动]列表里选择[本地存储] 挂载路径:在al ...

  7. Windows电脑挂载阿里云盘为本地磁盘(网络磁盘)

    Windows电脑将阿里云盘挂载为本地磁盘,全速访问资源,本篇文章依赖于阿里云盘的webdav功能,如果没有搭建的童鞋可以先搭建好webdav 搭建阿里云盘webdav的文章 群晖NAS同步阿里云盘: ...

  8. 将各种网盘挂载到本地,可以使用磁盘操作(建议收藏)

    特点: 1.基本满足所有网盘 2.挂载到本地之后使用的情况,完全取决于网速状况(延迟,带宽) 3.用CloudDrive挂载阿里云盘,对比之后发现CloudDrive不是很稳定.电脑开机或重启后挂载的 ...

  9. 挂在网盘到本地磁盘(以中移动云盘为例)

    发现百度网盘速度越来越慢,因此我想怎么讲百度网盘中300多个G的文件同步到移动云中,因此就有了这一步的探索. 利用Alist将中国移动网盘挂载到本地磁盘 解压Alist工具包,运行里面的alist-x ...

  10. winxp下虚拟机linux(ubuntu)系统如何访问本地磁盘

    参考:http://blog.csdn.net/js_gary/article/details/6010684 http://blog.163.com/zhanwei103@126/blog/stat ...

最新文章

  1. 依赖注入?依赖注入是如何实现解耦的?
  2. jittor和pytorch生成网络对比之pixelda
  3. dns-sd._udp.domain. 域名发现 本质和MDNS同
  4. C#面向对象_抽象类
  5. 内置类和对象锁改变 笔记记录
  6. 自用懒加载(其实效果并不是很好),自带的懒加载还好(2)(优化)
  7. Android studio之导入新库提示Add library ‘Gradle*****@aar‘ to classpath
  8. lucene学习笔记_学习Lucene
  9. HBase的Row Key设计
  10. Linux内核网络协议栈1- socket文件系统注册
  11. (一)获取上下文绘图环境
  12. Senparc.Weixin.MP SDK 微信公众平台开发教程(十):多客服接口说明
  13. 1000套精选微信小程序源码
  14. windows l2tp pptp设置
  15. Whitelabel Error Page 白页
  16. mysql查询在两个时间段之间的数据库_MySql查询时间段的方法
  17. 国外计算机论文翻译,计算机论文外文翻译
  18. 致我爱的动漫--Fate 系列 Part 1:《Fate/Zero》
  19. 天龙八部服务端Lua脚本系统(转)
  20. 小米笔记本电脑我的计算机图标不见了怎么办,毕业论文致谢结尾800字范文_本科毕业论文致谢结尾通用...

热门文章

  1. 大数据、云计算将催生IT产业大革命
  2. 数据导入与预处理-第8章-实战演练-数据分析师岗位分析
  3. 微软开始彻底封杀IE浏览器
  4. 使用新浪API生成短连接
  5. 企业微信调用扫一扫接口
  6. Excel查看工作表有多少列
  7. 计算机键盘上如何打对勾,电脑键盘怎么打对勾符号
  8. 多元函数的泰勒展开公式
  9. [转帖]优麒麟和银河麒麟操作系统都出自于天津麒麟信息技术有限公司
  10. Visio中画各种线条与箭头