OneDriveをローカルディスクUbuntuにマウント

3361 ワード

1.まず自分でOneDriveのネットディスクを登録する必要がある
2.rcloneモジュールマウントディスクのインストール
rcloneはubuntuのインストールライブラリがないので、一般的にapt-getは直接インストールできません.ダウンロードする必要があります.https://rclone.org/downloads/ダウンロード
wget https://downloads.rclone.org/v1.46/rclone-v1.46-linux-amd64.deb


dpkg -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:
  • Open https://apps.dev.microsoft.com/#/appList, then click  Add an app  (Choose  Converged applications  if applicable)
  • Enter a name for your app, and click continue. Copy and keep the  Application Id  under the app name for later use.
  • Under section  Application Secrets , click  Generate New Password . Copy and keep that password for later use.
  • Under section  Platforms , click  Add platform , then  Web . Enter  http://localhost:53682/  in  Redirect URLs .
  • Under section  Microsoft Graph PermissionsAdd  these  delegated permissionsFiles.ReadFiles.ReadWriteFiles.Read.AllFiles.ReadWrite.Alloffline_accessUser.Read .
  • 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     remote         17                          n               y               1       0      y                      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の速度は悪くなくて、国内のアクセスはアップロードしてダウンロードして基本的にすべて2 m/sがあります