FetchLinux远程管理指南
FetchLinux是基于SSH协议的远程文件管理工具,支持文件传输、目录操作、权限管理及集群协同等功能,适用于Linux系统的远程维护。以下是具体操作步骤:
# Debian/Ubuntu
sudo apt update && sudo apt install fetchlinux
# Red Hat/CentOS
sudo yum install fetchlinux
# Debian/Ubuntu
sudo dpkg -i fetchlinux_version.deb
# Red Hat/CentOS
sudo rpm -ivh fetchlinux_version.rpm
fetchlinux --version
fetchlinux
命令连接,格式为fetchlinux <用户名>@<远程主机IP/域名>
:fetchlinux user@192.168.1.100
fetchlinux user@remote_host:/path/to/remote/file /local/path
fetchlinux user@remote_host:/path/to/remote/dir /local/path -r
fetchlinux user@remote_host:/path/to/remote/*.txt /local/path
fetchlinux -u user@remote_host /local/path/file /path/to/remote
fetchlinux -u user@remote_host /local/path/dir -r /path/to/remote
fetchlinux user@remote_host ls /path/to/remote
fetchlinux user@remote_host rm /path/to/remote/file_or_dir
fetchlinux user@remote_host chmod 755 /path/to/remote/file
ssh-keygen -t rsa
ssh-copy-id user@remote_host
fetchlinux -i /path/to/private_key user@remote_host
-p
选项:fetchlinux user@remote_host -p 2222
-x
选项指定代理地址:fetchlinux user@remote_host -x http://proxy_host:proxy_port
sync.conf
)定义同步任务,示例如下:[source]
local_path = /path/to/local/dir
remote_path = user@remote_host:/path/to/remote/dir
[options]
compress = true # 启用压缩传输
verbose = true # 显示详细日志
# 指定配置文件同步
fetchlinux sync -c /path/to/sync.conf
# 定时同步(通过cron)
0 2 * * * /usr/bin/fetchlinux sync -c /path/to/sync.conf # 每天凌晨2点同步