rclone 等同雲端版 rsync,可以同步 / 備份資料到雲端,在不同雲端之間拷資料,把雲端 掛載成資料夾mount。支援 Google Drive、OneDrive、Dropbox、S3、Backblaze B2、FTP、SFTP、WebDAV。
ftp
rclone config
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
Enter name for new remote.
name> ftp1
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 S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, Cubbit, DigitalOcean, Dreamhost, Exaba, FileLu, FlashBlade, GCS, Hetzner, HuaweiOBS, IBMCOS, IDrive, Intercolo, IONOS, Leviia, Liara, Linode, LyveCloud, Magalu, Mega, Minio, Netease, Outscale, OVHcloud, Petabox, Qiniu, Rabata, RackCorp, Rclone, Scaleway, SeaweedFS, Selectel, Servercore, SpectraLogic, StackPath, Storj, Synology, TencentCOS, Wasabi, Zata, Other
\ (s3)
5 / Backblaze B2
\ (b2)
6 / Better checksums for other remotes
\ (hasher)
7 / Box
\ (box)
8 / Cache a remote
\ (cache)
9 / Citrix Sharefile
\ (sharefile)
10 / Cloudinary
\ (cloudinary)
11 / Combine several remotes into one
\ (combine)
12 / Compress a remote
\ (compress)
13 / DOI datasets
\ (doi)
14 / Dropbox
\ (dropbox)
15 / Encrypt/Decrypt a remote
\ (crypt)
16 / Enterprise File Fabric
\ (filefabric)
17 / FTP
\ (ftp)
18 / FileLu Cloud Storage
\ (filelu)
19 / Files.com
\ (filescom)
20 / Gofile
\ (gofile)
21 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
22 / Google Drive
\ (drive)
23 / Google Photos
\ (google photos)
24 / HTTP
\ (http)
25 / Hadoop distributed file system
\ (hdfs)
26 / HiDrive
\ (hidrive)
27 / ImageKit.io
\ (imagekit)
28 / In memory object storage system.
\ (memory)
29 / Internet Archive
\ (internetarchive)
30 / Jottacloud
\ (jottacloud)
31 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
32 / Linkbox
\ (linkbox)
33 / Local Disk
\ (local)
34 / Mail.ru Cloud
\ (mailru)
35 / Mega
\ (mega)
36 / Microsoft Azure Blob Storage
\ (azureblob)
37 / Microsoft Azure Files
\ (azurefiles)
38 / Microsoft OneDrive
\ (onedrive)
39 / OpenDrive
\ (opendrive)
40 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)
\ (swift)
41 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
42 / Pcloud
\ (pcloud)
43 / PikPak
\ (pikpak)
44 / Pixeldrain Filesystem
\ (pixeldrain)
45 / Proton Drive
\ (protondrive)
46 / Put.io
\ (putio)
47 / QingCloud Object Storage
\ (qingstor)
48 / Quatrix by Maytech
\ (quatrix)
49 / Read archives
\ (archive)
50 / SMB / CIFS
\ (smb)
51 / SSH/SFTP
\ (sftp)
52 / Sia Decentralized Cloud
\ (sia)
53 / Storj Decentralized Cloud Storage
\ (storj)
54 / Sugarsync
\ (sugarsync)
55 / Transparently chunk/split large files
\ (chunker)
56 / Uloz.to
\ (ulozto)
57 / Union merges the contents of several upstream fs
\ (union)
58 / Uptobox
\ (uptobox)
59 / WebDAV
\ (webdav)
60 / Yandex Disk
\ (yandex)
61 / Zoho
\ (zoho)
62 / iCloud Drive
\ (iclouddrive)
63 / premiumize.me
\ (premiumizeme)
64 / seafile
\ (seafile)
Storage> ftp
Option host.
FTP host to connect to.
E.g. "ftp.example.com".
Enter a value.
host> 192.168.1.3
Option user.
FTP username.
Enter a value of type string. Press Enter for the default (root).
user> maxkit
Option port.
FTP port number.
Enter a signed integer. Press Enter for the default (21).
port> 21
Option pass.
FTP password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Option tls.
Use Implicit FTPS (FTP over TLS).
When using implicit FTP over TLS the client connects using TLS
right from the start which breaks compatibility with
non-TLS-aware servers. This is usually served over port 990 rather
than port 21. Cannot be used in combination with explicit FTPS.
Enter a boolean value (true or false). Press Enter for the default (false).
tls> false
Option explicit_tls.
Use Explicit FTPS (FTP over TLS).
When using explicit FTP over TLS the client explicitly requests
security from the server in order to upgrade a plain text connection
to an encrypted one. Cannot be used in combination with implicit FTPS.
Enter a boolean value (true or false). Press Enter for the default (false).
explicit_tls>
Edit advanced config?
y) Yes
n) No (default)
y/n> y
Option concurrency.
Maximum number of FTP simultaneous connections, 0 for unlimited.
Note that setting this is very likely to cause deadlocks so it should
be used with care.
If you are doing a sync or copy then make sure concurrency is one more
than the sum of `--transfers` and `--checkers`.
If you use `--check-first` then it just needs to be one more than the
maximum of `--checkers` and `--transfers`.
So for `concurrency 3` you'd use `--checkers 2 --transfers 2
--check-first` or `--checkers 1 --transfers 1`.
Enter a signed integer. Press Enter for the default (0).
concurrency> 3
Option no_check_certificate.
Do not verify the TLS certificate of the server.
Enter a boolean value (true or false). Press Enter for the default (false).
no_check_certificate>
Option disable_epsv.
Disable using EPSV even if server advertises support.
Enter a boolean value (true or false). Press Enter for the default (false).
disable_epsv>
Option disable_mlsd.
Disable using MLSD even if server advertises support.
Enter a boolean value (true or false). Press Enter for the default (false).
disable_mlsd>
Option disable_utf8.
Disable using UTF-8 even if server advertises support.
Enter a boolean value (true or false). Press Enter for the default (false).
disable_utf8>
Option writing_mdtm.
Use MDTM to set modification time (VsFtpd quirk)
Enter a boolean value (true or false). Press Enter for the default (false).
writing_mdtm>
Option force_list_hidden.
Use LIST -a to force listing of hidden files and folders. This will disable the use of MLSD.
Enter a boolean value (true or false). Press Enter for the default (false).
force_list_hidden>
Option idle_timeout.
Max time before closing idle connections.
If no connections have been returned to the connection pool in the time
given, rclone will empty the connection pool.
Set to 0 to keep connections indefinitely.
Enter a duration s,m,h,d,w,M,y. Press Enter for the default (1m0s).
idle_timeout>
Option close_timeout.
Maximum time to wait for a response to close.
Enter a duration s,m,h,d,w,M,y. Press Enter for the default (1m0s).
close_timeout>
Option tls_cache_size.
Size of TLS session cache for all control and data connections.
TLS cache allows to resume TLS sessions and reuse PSK between connections.
Increase if default size is not enough resulting in TLS resumption errors.
Enabled by default. Use 0 to disable.
Enter a signed integer. Press Enter for the default (32).
tls_cache_size>
Option disable_tls13.
Disable TLS 1.3 (workaround for FTP servers with buggy TLS)
Enter a boolean value (true or false). Press Enter for the default (false).
disable_tls13>
Option allow_insecure_tls_ciphers.
Allow insecure TLS ciphers
Setting this flag will allow the usage of the following TLS ciphers in addition to the secure defaults:
- TLS_RSA_WITH_AES_128_GCM_SHA256
Enter a boolean value (true or false). Press Enter for the default (false).
allow_insecure_tls_ciphers>
Option shut_timeout.
Maximum time to wait for data connection closing status.
Enter a duration s,m,h,d,w,M,y. Press Enter for the default (1m0s).
shut_timeout>
Option ask_password.
Allow asking for FTP password when needed.
If this is set and no password is supplied then rclone will ask for a password
Enter a boolean value (true or false). Press Enter for the default (false).
ask_password>
Option socks_proxy.
Socks 5 proxy host.
Supports the format user:pass@host:port, user@host:port, host:port.
Example:
myUser:myPass@localhost:9005
Enter a value. Press Enter to leave empty.
socks_proxy>
Option http_proxy.
URL for HTTP CONNECT proxy
Set this to a URL for an HTTP proxy which supports the HTTP CONNECT verb.
Enter a value. Press Enter to leave empty.
http_proxy>
Option no_check_upload.
Don't check the upload is OK
Normally rclone will try to check the upload exists after it has
uploaded a file to make sure the size and modification time are as
expected.
This flag stops rclone doing these checks. This enables uploading to
folders which are write only.
You will likely need to use the --inplace flag also if uploading to
a write only folder.
Enter a boolean value (true or false). Press Enter for the default (false).
no_check_upload>
Option encoding.
The encoding for the backend.
See the [encoding section in the overview](/overview/#encoding) for more info.
Choose a number from below, or type in your own value of type Encoding.
Press Enter for the default (Slash,Del,Ctl,RightSpace,Dot).
1 / ProFTPd can't handle '*' in file names
\ (Asterisk,Ctl,Dot,Slash)
2 / PureFTPd can't handle '[]' or '*' in file names
\ (BackSlash,Ctl,Del,Dot,RightSpace,Slash,SquareBracket)
3 / VsFTPd can't handle file names starting with dot
\ (Ctl,LeftPeriod,Slash)
encoding>
Option description.
Description of the remote.
Enter a value. Press Enter to leave empty.
description>
Edit advanced config?
y) Yes
n) No (default)
y/n>
Configuration complete.
Options:
- type: ftp
- host: 192.168.1.3
- user: maxkit
- pass: *** ENCRYPTED ***
- concurrency: 3
Keep this "ftp1" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
ftp1 ftp
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
測試,注意 ls 會遞迴進入所有目錄 list 所有檔案
# list directory
rclone lsd ftp1:
# list file
rclone ls ftp1:
看到清單就代表連線 OK
mount 目錄
# 建立目錄
mkdir -p /mnt/ftp1
# mount --daemon 會 fork 到前景,測試時可不需要用
rclone mount ftp1: /mnt/ftp1 \
--vfs-cache-mode full \
--vfs-cache-max-size 5G \
--vfs-cache-max-age 24h \
--allow-other \
--daemon
ls /mnt/ftp1
# unmount
fusermount3 -u /mnt/ftp1
#rclone unmount /mnt/ftp1
systemd service
vi /etc/systemd/system/rclone-ftp1.service
[Unit]
Description=Rclone FTP Mount
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/rclone mount ftp1: /mnt/ftp1 \
--vfs-cache-mode full \
--vfs-cache-max-size 5G \
--vfs-cache-max-age 24h \
--allow-other
ExecStop=/bin/fusermount3 -u /mnt/ftp1
Restart=always
User=root
[Install]
WantedBy=multi-user.target
啟用
systemctl daemon-reload
systemctl enable --now rclone-ftp1
sftp
設定
e/n/d/r/c/s/q> n
Enter name for new remote.
name> sftp1
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 S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, Cubbit, DigitalOcean, Dreamhost, Exaba, FileLu, FlashBlade, GCS, Hetzner, HuaweiOBS, IBMCOS, IDrive, Intercolo, IONOS, Leviia, Liara, Linode, LyveCloud, Magalu, Mega, Minio, Netease, Outscale, OVHcloud, Petabox, Qiniu, Rabata, RackCorp, Rclone, Scaleway, SeaweedFS, Selectel, Servercore, SpectraLogic, StackPath, Storj, Synology, TencentCOS, Wasabi, Zata, Other
\ (s3)
5 / Backblaze B2
\ (b2)
6 / Better checksums for other remotes
\ (hasher)
7 / Box
\ (box)
8 / Cache a remote
\ (cache)
9 / Citrix Sharefile
\ (sharefile)
10 / Cloudinary
\ (cloudinary)
11 / Combine several remotes into one
\ (combine)
12 / Compress a remote
\ (compress)
13 / DOI datasets
\ (doi)
14 / Dropbox
\ (dropbox)
15 / Encrypt/Decrypt a remote
\ (crypt)
16 / Enterprise File Fabric
\ (filefabric)
17 / FTP
\ (ftp)
18 / FileLu Cloud Storage
\ (filelu)
19 / Files.com
\ (filescom)
20 / Gofile
\ (gofile)
21 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
22 / Google Drive
\ (drive)
23 / Google Photos
\ (google photos)
24 / HTTP
\ (http)
25 / Hadoop distributed file system
\ (hdfs)
26 / HiDrive
\ (hidrive)
27 / ImageKit.io
\ (imagekit)
28 / In memory object storage system.
\ (memory)
29 / Internet Archive
\ (internetarchive)
30 / Jottacloud
\ (jottacloud)
31 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
32 / Linkbox
\ (linkbox)
33 / Local Disk
\ (local)
34 / Mail.ru Cloud
\ (mailru)
35 / Mega
\ (mega)
36 / Microsoft Azure Blob Storage
\ (azureblob)
37 / Microsoft Azure Files
\ (azurefiles)
38 / Microsoft OneDrive
\ (onedrive)
39 / OpenDrive
\ (opendrive)
40 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)
\ (swift)
41 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
42 / Pcloud
\ (pcloud)
43 / PikPak
\ (pikpak)
44 / Pixeldrain Filesystem
\ (pixeldrain)
45 / Proton Drive
\ (protondrive)
46 / Put.io
\ (putio)
47 / QingCloud Object Storage
\ (qingstor)
48 / Quatrix by Maytech
\ (quatrix)
49 / Read archives
\ (archive)
50 / SMB / CIFS
\ (smb)
51 / SSH/SFTP
\ (sftp)
52 / Sia Decentralized Cloud
\ (sia)
53 / Storj Decentralized Cloud Storage
\ (storj)
54 / Sugarsync
\ (sugarsync)
55 / Transparently chunk/split large files
\ (chunker)
56 / Uloz.to
\ (ulozto)
57 / Union merges the contents of several upstream fs
\ (union)
58 / Uptobox
\ (uptobox)
59 / WebDAV
\ (webdav)
60 / Yandex Disk
\ (yandex)
61 / Zoho
\ (zoho)
62 / iCloud Drive
\ (iclouddrive)
63 / premiumize.me
\ (premiumizeme)
64 / seafile
\ (seafile)
Storage> sftp
Option host.
SSH host to connect to.
E.g. "example.com".
Enter a value.
host> 192.168.1.3
Option user.
SSH username.
Enter a value of type string. Press Enter for the default (root).
user> maxkit
Option port.
SSH port number.
Enter a signed integer. Press Enter for the default (22).
port>
Option pass.
SSH password, leave blank to use ssh-agent.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Option key_pem.
Raw PEM-encoded private key.
Note that this should be on a single line with line endings replaced with '\n', eg
key_pem = -----BEGIN RSA PRIVATE KEY-----\nMaMbaIXtE\n0gAMbMbaSsd\nMbaass\n-----END RSA PRIVATE KEY-----
This will generate the single line correctly:
awk '{printf "%s\\n", $0}' < ~/.ssh/id_rsa
If specified, it will override the key_file parameter.
Enter a value. Press Enter to leave empty.
key_pem>
Option key_file.
Path to PEM-encoded private key file.
Leave blank or set key-use-agent to use ssh-agent.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
key_file>
Option key_file_pass.
The passphrase to decrypt the PEM-encoded private key file.
Only PEM encrypted key files (old OpenSSH format) are supported. Encrypted keys
in the new OpenSSH format can't be used.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Option pubkey.
SSH public certificate for public certificate based authentication.
Set this if you have a signed certificate you want to use for authentication.
If specified will override pubkey_file.
Enter a value. Press Enter to leave empty.
pubkey>
Option pubkey_file.
Optional path to public key file.
Set this if you have a signed certificate you want to use for authentication.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
pubkey_file>
Option key_use_agent.
When set forces the usage of the ssh-agent.
When key-file is also set, the ".pub" file of the specified key-file is read and only the associated key is
requested from the ssh-agent. This allows to avoid `Too many authentication failures for *username*` errors
when the ssh-agent contains many keys.
Enter a boolean value (true or false). Press Enter for the default (false).
key_use_agent>
Option use_insecure_cipher.
Enable the use of insecure ciphers and key exchange methods.
This enables the use of the following insecure ciphers and key exchange methods:
- aes128-cbc
- aes192-cbc
- aes256-cbc
- 3des-cbc
- diffie-hellman-group-exchange-sha256
- diffie-hellman-group-exchange-sha1
Those algorithms are insecure and may allow plaintext data to be recovered by an attacker.
This must be false if you use either ciphers or key_exchange advanced options.
Choose a number from below, or type in your own boolean value (true or false).
Press Enter for the default (false).
1 / Use default Cipher list.
\ (false)
2 / Enables the use of the aes128-cbc cipher and diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1 key exchange.
\ (true)
use_insecure_cipher>
Option disable_hashcheck.
Disable the execution of SSH commands to determine if remote file hashing is available.
Leave blank or set to false to enable hashing (recommended), set to true to disable hashing.
Enter a boolean value (true or false). Press Enter for the default (false).
disable_hashcheck>
Option ssh.
Path and arguments to external ssh binary.
Normally rclone will use its internal ssh library to connect to the
SFTP server. However it does not implement all possible ssh options so
it may be desirable to use an external ssh binary.
Rclone ignores all the internal config if you use this option and
expects you to configure the ssh binary with the user/host/port and
any other options you need.
**Important** The ssh command must log in without asking for a
password so needs to be configured with keys or certificates.
Rclone will run the command supplied either with the additional
arguments "-s sftp" to access the SFTP subsystem or with commands such
as "md5sum /path/to/file" appended to read checksums.
Any arguments with spaces in should be surrounded by "double quotes".
An example setting might be:
ssh -o ServerAliveInterval=20 user@example.com
Note that when using an external ssh binary rclone makes a new ssh
connection for every hash it calculates.
Enter a value of type SpaceSepList. Press Enter to leave empty.
ssh>
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Configuration complete.
Options:
- type: sftp
- host: 192.168.1.3
- user: maxkit
- pass: *** ENCRYPTED ***
- key_file_pass: *** ENCRYPTED ***
Keep this "sftp1" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
ftp1 ftp
sftp1 sftp
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
mount
mkdir -p /mnt/sftp1
測試
rclone lsd sftp1:
rclone mount sftp1:/ /mnt/sftp1 \
--allow-other \
--vfs-cache-mode full \
--buffer-size 64M \
--daemon
ls -al /mnt/sftp1/
/bin/fusermount3 -u /mnt/sftp1
service
vi /etc/systemd/system/rclone-sftp1.service
[Unit]
Description=Rclone SFTP Mount
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/rclone mount sftp1: /mnt/sftp1 \
--vfs-cache-mode full \
--buffer-size 64M \
--allow-other
ExecStop=/bin/fusermount3 -u /mnt/sftp1
Restart=always
User=root
[Install]
WantedBy=multi-user.target
啟動
systemctl daemon-reload
systemctl enable --now rclone-sftp1
直接編輯設定檔
# pwd 手動用 rclone 自帶工具加密
rclone obscure "yourpassword"
# 把結果放到 pass = <OBSCURED_PASSWORD>
設定檔
~/.config/rclone/rclone.conf
[ftp1]
type = ftp
host = 192.168.1.3
user = maxkit
pass = TwE1qxopK3QB87j3QOEn9-WH0HrZhhsC
concurrency = 3
[sftp1]
type = sftp
host = 192.168.1.3
user = maxkit
pass = EhKh5h2NNeX0W0FIej8M8xoP1o5rJeER
key_file_pass = TW5-tYJMrtLeF6ys1E2wIhM5Amm8PG5K
shell_type = unix
md5sum_command = md5sum
sha1sum_command = sha1sum
chmod 600 ~/.config/rclone/rclone.conf
沒有留言:
張貼留言