当前位置: 首页 > news >正文

系统之间文件同步方案

rclone

linux安装

# 获取和解压缩
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64
# 复制二进制文件
sudo cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone
# 安装手册
sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb

linux配置

# 生成密钥 
ssh-keygen -t ed25519 -f ~/.ssh/rclone_sync_key # 部署公钥
ssh-copy-id -i ~/.ssh/rclone_sync_key.pub  root@ip地址 
# 配置链接
rclone config
[root@docker /]# rclone config
Current remotes:Name                 Type
====                 ====
demo                 sftp
demo1                sftp
sync                 sftpe) 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> nEnter name for new remote.
name> 247Option 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, DigitalOcean, Dreamhost, Exaba, FlashBlade, GCS, HuaweiOBS, IBMCOS, IDrive, IONOS, LyveCloud, Leviia, Liara, Linode, Magalu, Mega, Minio, Netease, Outscale, OVHcloud, Petabox, RackCorp, Rclone, Scaleway, SeaweedFS, Selectel, StackPath, Storj, Synology, TencentCOS, Wasabi, Qiniu, Zata and others\ (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 / SMB / CIFS\ (smb)
50 / SSH/SFTP\ (sftp)
51 / Sia Decentralized Cloud\ (sia)
52 / Storj Decentralized Cloud Storage\ (storj)
53 / Sugarsync\ (sugarsync)
54 / Transparently chunk/split large files\ (chunker)
55 / Uloz.to\ (ulozto)
56 / Union merges the contents of several upstream fs\ (union)
57 / Uptobox\ (uptobox)
58 / WebDAV\ (webdav)
59 / Yandex Disk\ (yandex)
60 / Zoho\ (zoho)
61 / iCloud Drive\ (iclouddrive)
62 / premiumize.me\ (premiumizeme)
63 / seafile\ (seafile)
Storage> 50Option host.
SSH host to connect to.
E.g. "example.com".
Enter a value.
host> 192.168.102.247Option user.
SSH username.
Enter a value of type string. Press Enter for the default (root).
user> 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> nOption key_pem.
Raw PEM-encoded private key.
Note that this should be on a single line with line endings replaced with '\n', egkey_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> ~/.ssh/rclone_sync_keyOption 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> 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> Configuration complete.
Options:
- type: sftp
- host: 192.168.102.247
- key_file: ~/.ssh/rclone_sync_key
Keep this "247" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>

自动化处理密码加密场景

# 需先对明文密码加密,结果输出到pass.txt
rclone obscure "mypassword" > pass.txt  
rclone config password 配置名 字段名=$(cat pass.txt)
# 以下命令将安全删除文件pass.txt
shred -u pass.txt  
# 覆盖内容:默认覆盖 3 次,使用随机数据。
# 删除文件:覆盖完成后,文件会被从文件系统中移除。
# 自定义覆盖次数
# 可以通过 -n 参数指定覆盖次数。例如,覆盖 5 次并删除文件:
# shred -u -n 5 example.txt
# 对于整个硬盘或分区,可以使用以下命令:
# shred -u -n 10 /dev/sda

基本命令

# 将demo1主机D:\0素材\axus目录下的文件同步到本机 /data/test/ 目录下
rclone sync --create-empty-src-dirs --progress 'demo1:D:\0素材\axus' /data/test/ 
# --create-empty-src-dirs:创建空目录,空目录也同步到目标路径
# --progress:显示进度#将本机data目录下的文件同步到demo主机的/data目录下
rclone sync --create-empty-src-dirs --progress /data/ demo:/data 
# --create-empty-src-dirs:创建空目录,空目录也同步到目标路径
http://www.dtcms.com/a/465151.html

相关文章:

  • VTK实战:vtkImplicitSelectionLoop——用隐式函数实现“环选”的核心逻辑与工程实践
  • 使用compose和WheelView实现仿IOS中的3D滚轮控件-三级联动
  • Burpsuite工具使用
  • 做网站设计电脑需要什么配置企业如何建设网站呢
  • 旅游网站制作内容淘宝网站小视频怎么做的
  • 关于 Qt 6.10.0 中 FolderListModel 返回 undefined 路径
  • 做展会怎么引流到自己的网站小程序生成器
  • 【第五章:计算机视觉-项目实战之生成式算法实战:扩散模型】3.生成式算法实战:扩散模型-(1)从零开始训练自己的扩散模型
  • [VoiceRAG] 集成向量化 | Azure AI Search中建立自动化系统
  • 从效能革命到体验重构,易路 AI Agent 破局 HR 三重困境
  • 计算机视觉(opencv)——基于 OpenCV DNN 的实时人脸检测 + 年龄与性别识别
  • Flink 状态后端(State Backends)实战原理、选型、配置与调优
  • Node.js HTTP开发
  • 在 Mac 上使用 Docker 安装 Milvus 2.6.2
  • 福州市住房和城乡建设部网站wordpress 数据导入
  • 北京网站设计技术wordpress 评论验证
  • 亚马逊测评总踩雷?自养号技术筑牢安全防线,避开封号坑
  • Ubuntu 20.04 使用 Issac Gym 进行宇树G1人形机器人进行强化学习训练(Linux仿真)
  • 制造业工艺文档安全协作与集中管理方案
  • 场景美术师的“无限画板”:UE5中非破坏性的材质混合(Material Blending)工作流
  • 黑马微服务P3快速入门入门案例无法跑通解决方案,本文解决了数据库连接和java版本不匹配的问题
  • 遗留系统微服务改造(三):监控运维与最佳实践总结
  • 四川建设招标网站首页自己做的网站显示不安全怎么回事
  • 网络层协议之OSPF协议
  • vue3+hubuilderX开发微信小程序使用elliptic生成ECDH密钥对遇到的问题
  • 跑马灯组件 Vue2/Vue3/uni-app/微信小程序
  • 网络攻防实战:如何防御DDoS攻击
  • 能力(5)
  • 多模态医疗大模型Python编程合规前置化与智能体持续学习研究(下)
  • wordpress网站不显示系列秦皇岛网站制作与网站建设