美文网首页
rclone挂载onedrive

rclone挂载onedrive

作者: SAops | 来源:发表于2019-05-20 09:37 被阅读0次

    在Mac/Centos上使用rclone挂载OneDrive网盘

    1.png

    关于平时我们可以通过挂载FTP来增大mac/win/linux硬盘空间。也可以使用rclone挂载OneDrive/Google Drive/Amazon Drive等云存储,同时还支持全平台,意味着您可以在Windows、Mac OS、Linux上进行使用,本文将讲述挂载FTP,和onedrive,本人在测试googledrive 时会timeout,原因大家都懂得。

    前提说明:服务器上CentOS大部分未安装图形界面,rclone挂载必须要在有内置浏览器的电脑才能正常完成授权,因此我们要在本地Windows/Mac电脑安装rclone并获取授权后的token,再将其复制到CentOS的服务器上。刚好也可以证明支持全平台。

    Linux 挂载FTP

    1、 安装CurlFtpFS

    centos系统
    1、yum -y install epel-release && yum -y install curlftpfs
    ubantu系统
    apt-get install curlftpfs -y

    2、挂载FTP

    # 创建目录,路径及名称
    mkdir /home/tmp
    # 挂载FTP
    curlftpfs yourserver.com /home/ftp -o user=username:password
    

    参数说明
    yourserver.com #FTP地址

    /home/ftp #本地目录

    username #FTP用户名

    password #FTP密码

    3、 检查

    输入df -h命令查下是否挂载成功

    linux 通过rclone挂载onedrive

    mac 安装rclone

    默认:在本地mac电脑上下载rclone,下载地址:二进制
    参考 githubgithub地址
    通过 终端命令行下载

    cd && curl -O https://downloads.rclone.org/rclone-current-osx-amd64.zip
    

    解压

    unzip -a rclone-current-osx-amd64.zip && cd rclone-*-osx-amd64
    

    创建目录并移动rclone

    sudo mkdir -p /usr/local/bin
    sudo mv rclone /usr/local/bin/
    

    配置获取token

    初始化配置

    rclone config
    

    显示结果

    n) New remote
    s) Set configuration password
    q) Quit config
    n/s/q> n
    name> onedrive  #注意后面要用到
    Type of storage to configure.
    Choose a number from below, or type in your own value
    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
    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
    ...
    19 / Microsoft OneDrive
       \ "onedrive"
    ...
    Storage> 19 #根据自己到版本选择
    Microsoft App Client Id - leave blank normally.
    client_id>  #enter
    Microsoft App Client Secret - leave blank normally.
    client_secret>  #enter
    Remote config
    Choose OneDrive account type?
     * Say b for a OneDrive business account
     * Say p for a personal OneDrive account
    b) Business
    p) Personal
    b/p> p  #这里选择个人版,你想挂载Business就选择b
    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  #选择n
    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> {"access_token":""}   #复制{xx}整个内容,**包括大括号{}**,后面centos挂载会用到
    --------------------
    [onedrive]
    client_id = 
    client_secret = 
    token = {"access_token":""}
    --------------------
    y) Yes this is OK
    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退出
    

    ==onedrive大伙可去网上找相关文档申请免费5T==

    到此 基本算是完成配置,可以尝试在mac挂载

    首次挂载会出错,因为mac文件系统原因找不到OSXFUSE

    1、 Fatal error: failed to mount FUSE fs: cannot locate OSXFUSE
    
    2、  error: Directory is not empty: /data If you want to mount it anyway use: --allow-non-empty option
    
    3、  mount helper error: mount_osxfuse: failed to mount /onedrive@/dev/osxfuse0: Operation not permitted
     Fatal error: failed to mount FUSE fs: mount_osxfusefs: exit status 71
    
    

    解决方案:

    下载相应的版本
    1、osxfuse

    2、目录可以重新创建一个

    3、目录创建到当前用户下 mac/Users/xxxx

    centos 安装rclone

    直接使用官方的一键安装命令即可,输入下面的命令:

    curl https://rclone.org/install.sh | sudo bash
    
    

    CentOS挂载Onedrive

    接下来操作方法和mac完全一样,就不重复了,唯一的区别是“Use auto config?”这里选择n,并输入之前获取的token

    ==是否自动配置==

      Use auto config?
     * Say Y if not sure
     * Say N if you are working on a remote or headless machine
    y) Yes
    n) Noy/n> n  #在这里输入nFor this to work, you will need rclone available on a machine that has a web browser available.
    

    输入TOKEN

    Execute the following on your machine:
        rclone authorize "onedrive"Then paste the result below:result> {"access_token":""}  #粘贴之前在客户端授权的内容,包括大括号一起粘贴进去
    

    挂载 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

    DriveName为初始化配置填的name,Folder为oneDrive里的文件夹,可以为/,LocalFolder为centos上的本地文件夹。

    查看挂载情况

    df -h

    2.png

    ==centos需要下载fuse==

    #安装fuse
    

    yum -y install fuse

     #创建挂载目录
    

    mkdir -p /home/onedrive

    #挂载
    
    #如果需要后台保持运行,使用下面的命令
    

    nohup rclone mount remote:path/to/files /home/onedrive &

    相关文章

      网友评论

          本文标题:rclone挂载onedrive

          本文链接:https://www.haomeiwen.com/subject/tqjhzqtx.html