FetchLinux远程管理使用指南
FetchLinux是一款基于SSH协议的远程文件管理工具,主要用于本地与远程Linux系统间的文件传输、目录操作及远程命令执行。以下是其核心功能的详细使用说明:
FetchLinux的安装方式因操作系统而异,需根据系统类型选择对应命令:
sudo dpkg -i fetchlinux_version.deb(需提前下载.deb安装包)。sudo yum install fetchlinux_version.rpm或sudo dnf install fetchlinux_version.rpm(需提前下载.rpm安装包)。fetchlinux --version验证安装是否成功。使用fetchlinux命令连接远程服务器,基本语法为:
fetchlinux user@remote_host
其中,user为远程服务器的用户名(如root、ubuntu),remote_host为远程服务器的IP地址或域名(如192.168.1.100、example.com)。
连接时需输入远程用户的密码(若未配置SSH密钥)。
fetchlinux user@remote_host:/path/to/remote/file /local/path(如fetchlinux root@192.168.1.100:/home/user/test.txt ./)。-r参数,如fetchlinux -r user@remote_host:/path/to/remote/dir /local/path。fetchlinux user@remote_host:/path/to/remote/*.txt /local/path(下载所有.txt文件)。fetchlinux -u user@remote_host /local/path/file /path/to/remote(如fetchlinux -u root@192.168.1.100 ./test.txt /home/user/)。-r参数,如fetchlinux -u -r user@remote_host /local/path/dir /path/to/remote。fetchlinux user@remote_host ls /path/to/remote(如fetchlinux root@192.168.1.100 ls /home/user/,显示远程目录下的文件和子目录)。fetchlinux user@remote_host rm /path/to/remote/file_or_directory(如fetchlinux root@192.168.1.100 rm /home/user/test.txt删除文件;fetchlinux root@192.168.1.100 rm -r /home/user/test_dir递归删除目录)。修改远程文件或目录的权限,语法为:
fetchlinux user@remote_host chmod permissions /path/to/remote/file_or_directory
例如,将远程/home/user/test.txt的权限设置为755(所有者可读可写可执行,组和其他用户可读可执行),执行:
fetchlinux root@192.168.1.100 chmod 755 /home/user/test.txt。
使用-i参数指定私钥文件路径,如:
fetchlinux -i /path/to/private_key user@remote_host(私钥文件通常位于~/.ssh/id_rsa)。
若远程服务器的SSH端口不是默认的22,使用-p参数指定,如:
fetchlinux user@remote_host -p 2222(连接remote_host的2222端口)。
通过-x参数设置代理,格式为http://proxy_host:proxy_port,如:
fetchlinux user@remote_host -x http://proxy.example.com:8080(通过代理连接远程服务器)。