通用云存储命令行管理工具,支持多种网络存储( 如Amazon S3、Microsoft Azure Blob Storage、Microsoft Azure Files Storage、Microsoft OneDrive、Google Cloud Storage、Ceph、FTP 等)
zypper install -y fuse fuse3
yum install -y fuse fuse3
/opt/rclone
)mkdir -pv /opt/rclone
下载地址:
示例:
cd /opt/rclone
wget https://downloads.rclone.org/v1.66.0/rclone-v1.66.0-linux-amd64.zip
unzip rclone-v1.66.0-linux-amd64.zip
ln -s /opt/rclone/rclone-v1.66.0-linux-amd64/rclone /opt/rclone/rclone
下载安装包
访问官网下载地址( https://downloads.rclone.org/ ),下载对应版本的安装包
解压安装包到指定目录
运行 rclone.exe 文件
/opt/rclone/rclone config
输入 n
,新建 remote
输入新建 remote 的名称,此处示例使用 onedrive
选择远程存储类型,此处示例使用 31
(onedrive
)
输入 client_id
,此处示例为空
输入 client_secret
,此处示例为空
输入 OneDrive 所属区域,此处示例为 1
(global
)
选择是否使用高级配置,此处使用选择 n
选择是否开启浏览器并自动配置,若机器可打开浏览器,则选择 y
,若机器不可打开浏览器,则选择 n
,此处示例选择 n
获取 config_token(当上一步选择 n
时,需要在可打开浏览器的机器上安装 rclone,然后执行指定的命令,此处示例命令为 rclone authorize "onedrive"
)
输入 config_token(当上上步选择 n
时,在可打开浏览器的机器执行 rclone 命令后会获取到一个字符串,将字符串配置于此处即可)
选择 OneDrive 类型,此处示例为 1
(OneDrive Personal or Business
)
选择使用的 OneDrive 网盘,根据列出的选项选择即可
输入 y
,确认网盘
输入 y
,确认配置
输入 q
,退出配置
配置示例:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
Enter name for new remote.
name> onedrive
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon Drive
\ (amazon cloud drive)
5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Liara, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
\ (s3)
6 / Backblaze B2
\ (b2)
7 / Better checksums for other remotes
\ (hasher)
8 / Box
\ (box)
9 / Cache a remote
\ (cache)
10 / Citrix Sharefile
\ (sharefile)
11 / Combine several remotes into one
\ (combine)
12 / Compress a remote
\ (compress)
13 / Dropbox
\ (dropbox)
14 / Encrypt/Decrypt a remote
\ (crypt)
15 / Enterprise File Fabric
\ (filefabric)
16 / FTP
\ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
18 / Google Drive
\ (drive)
19 / Google Photos
\ (google photos)
20 / HTTP
\ (http)
21 / Hadoop distributed file system
\ (hdfs)
22 / HiDrive
\ (hidrive)
23 / In memory object storage system.
\ (memory)
24 / Internet Archive
\ (internetarchive)
25 / Jottacloud
\ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
27 / Local Disk
\ (local)
28 / Mail.ru Cloud
\ (mailru)
29 / Mega
\ (mega)
30 / Microsoft Azure Blob Storage
\ (azureblob)
31 / Microsoft OneDrive
\ (onedrive)
32 / OpenDrive
\ (opendrive)
33 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
34 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
35 / Pcloud
\ (pcloud)
36 / Put.io
\ (putio)
37 / QingCloud Object Storage
\ (qingstor)
38 / SMB / CIFS
\ (smb)
39 / SSH/SFTP
\ (sftp)
40 / Sia Decentralized Cloud
\ (sia)
41 / Storj Decentralized Cloud Storage
\ (storj)
42 / Sugarsync
\ (sugarsync)
43 / Transparently chunk/split large files
\ (chunker)
44 / Union merges the contents of several upstream fs
\ (union)
45 / Uptobox
\ (uptobox)
46 / WebDAV
\ (webdav)
47 / Yandex Disk
\ (yandex)
48 / Zoho
\ (zoho)
49 / premiumize.me
\ (premiumizeme)
50 / seafile
\ (seafile)
Storage> 31
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id>
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
1 / Microsoft Cloud Global
\ (global)
2 / Microsoft Cloud for US Government
\ (us)
3 / Microsoft Cloud Germany
\ (de)
4 / Azure and Office 365 operated by Vnet Group in China
\ (cn)
region> 1
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes (default)
n) No
y/n> n
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "onedrive"
Then paste the result.
Enter a value.
config_token> 此处为在可打开浏览器的机器上安装rclone后,执行上方命令后返回的字符串,需要将字符串完整复制到此处
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
1 / OneDrive Personal or Business
\ (onedrive)
2 / Root Sharepoint site
\ (sharepoint)
/ Sharepoint site name or URL
3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
\ (url)
4 / Search for a Sharepoint site
\ (search)
5 / Type in driveID (advanced)
\ (driveid)
6 / Type in SiteID (advanced)
\ (siteid)
/ Sharepoint server-relative path (advanced)
7 | E.g. /teams/hr
\ (path)
config_type> 1
Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default (111222333).
1 / (personal)
\ (111222333)
config_driveid> 1
Drive OK?
Found drive "root" of type "personal"
URL: https://onedrive.live.com/?cid=111222333
y) Yes (default)
n) No
y/n> y
Configuration complete.
Options:
- type: onedrive
- token: 此处为config_token中配置的字符串
- drive_id: 111222333
- drive_type: personal
Keep this "onedrive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> 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
rclone lsd 名称:路径
参数说明:
--max-depth 层级
: 指定遍历层级,不指定时默认不遍历-R
: 遍历全部子目录onedrive
网盘的 /
目录下的子目录):rclone lsd onedrive:/
rclone ls 名称:路径
参数说明:
--max-depth 层级
: 指定遍历层级,不指定时默认遍历全部层级示例:
onedrive
网盘的 /
目录下的全部文件(含子目录)):rclone ls onedrive:/
onedrive
网盘的 /
目录下的全部文件(不含子目录)):rclone ls onedrive:/ --max-depth 1
rclone lsl 名称:路径
参数说明:
--max-depth 层级
: 指定遍历层级,不指定时默认不遍历-R
: 遍历全部子目录示例:
onedrive
网盘的 /
目录下的文件:rclone lsl onedrive:/
onedrive
网盘的 /
目录及其子目录下的文件:rclone lsl onedrive:/ --max-depth 2
onedrive
网盘的 /
目录及其全部子目录下的文件:rclone lsl onedrive:/ --R
rclone lsf 名称:路径
示例(列出 onedrive
网盘的 /
目录下的对象并格式化):
rclone lsf onedrive:/
rclone lsjson 名称:路径
示例(列出 onedrive
网盘的 /
目录下的对象并格式化为json):
rclone lsjson onedrive:/
说明: 此处示例将
onedrive
网盘的/demo
目录挂载至本地的/test
目录
mkdir -pv /test
/opt/rclone/rclone mount onedrive:/demo /test --vfs-cache-mode writes
df -h
ls -l /test
Ctrl + C
即可在挂载时添加 --daemon
参数即可。
onedrive
网盘的 /demo
目录后台挂载至本地的 /test
目录):/opt/rclone/rclone mount onedrive:/demo /test --vfs-cache-mode writes --daemon
说明:
- 此处示例将
onedrive
网盘的/demo
目录挂载至本地的/test
目录- 新建的 screen 虚拟终端的名称为
onedrive
- 挂载命令中的
/opt/rclone/rclone
为 rclone 安装目录,onedrive
为需要挂载的网盘名称,/demo
为网盘目录,/test
为本地目录
zypper install -y screen
yum install -y screen
screen -S onedrive
/opt/rclone/rclone mount onedrive:/demo /test --vfs-cache-mode writes
退出 screen 虚拟终端
Ctrl + A + D
检查挂载情况
df -h
ls -l /test
Ctrl + C
即可screen -r onedrive
说明:
- 此处示例将 onedrive 网盘的 /demo 目录挂载至本地的 /test 目录
- 新建的 service 文件名称为 rclone.service
- service 文件中的
/opt/rclone/rclone
为 rclone 安装目录,onedrive
为需要挂载的网盘名称,/demo
为网盘目录,/test
为本地目录
vim /usr/lib/systemd/system/rclone.service
[Unit]
Description=Rclone Mount Demo
Requires=network-online.target
After=network-online.target
[Service]
Type=notify
User=root
ExecStart=/opt/rclone/rclone mount onedrive:/demo /test --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --vfs-cache-mode writes
ExecStop=umount /test
TimeoutStartSec=infinity
ExecReload=/bin/kill -SIGHUP $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start rclone.service
附:
systemctl status rclone.service
systemctl start rclone.service
systemctl stop rclone.service
systemctl enable rclone.service
systemctl disable rclone.service
systemctl status rclone.service
systemctl start rclone.service
systemctl stop rclone.service
systemctl enable rclone.service
systemctl disable rclone.service
rclone help
rclone help backends
rclone help flags
rclone version
rclone config show
rclone config file
rclone config update
rclone config create 名称 类型
rclone config delete 名称
rclone config
rclone mount remote名称:网盘路径 本地路径 参数
参数说明:
--daemon
: 后台挂载--read-only
: 只读挂载--allow-non-empty
: 允许挂载至非空目录--dir-cache-time 时间
: 指定目录缓存时间(默认为 5m )--poll-interval 时间
: 指定轮询间隔(默认为 1m )--cache-dir 目录
: 指定缓存目录--vfs-cache-mode 模式
: 指定缓存模式,off
表示不缓存、minimal
表示最小缓存(仅读取和写入时将缓存)、writes
表示缓存只写和读写文件、full
表示缓存全部文件,默认为 off
--vfs-read-chunk-size 大小
: 指定分块读取时每块的大小,默认为 128M,设置为 0
时将禁用分块读取--vfs-read-chunk-size-limit 大小
: 指定分块读取时最大加倍大小,及每次读取时允许相较前一块的大小多少--no-checksum
: 上传下载时不校验--no-modtime
: 不读取和写入更新时间--no-seek
: 不允许在文件中查找示例:
onedrive
网盘的 /demo
目录挂载至本地的 /test
):/opt/rclone/rclone mount onedrive:/demo /test
onedrive
网盘的 /demo
目录后台挂载至本地的 /test
):/opt/rclone/rclone mount onedrive:/demo /test --daemon
onedrive
网盘的 /demo
目录只读挂载至本地的 /test
):/opt/rclone/rclone mount onedrive:/demo /test --daemon --read-only