在CentOS系统中,使用SSH进行文件传输通常有两种方法:SCP(Secure Copy Protocol)和SFTP(SSH File Transfer Protocol)。以下是这两种方法的详细步骤:
scp /path/to/local/file username@remote_host:/path/to/remote/directory
/path/to/local/file 是本地文件的路径。username 是远程服务器的用户名。remote_host 是远程服务器的IP地址或主机名。/path/to/remote/directory 是远程服务器上的目标目录。scp username@remote_host:/path/to/remote/file /path/to/local/directory
scp -r /path/to/local/directory username@remote_host:/path/to/remote/directory
-r 选项表示递归复制整个目录。sftp username@remote_host
put /path/to/local/file /path/to/remote/directory
get /path/to/remote/file /path/to/local/directory
put -r /path/to/local/directory /path/to/remote/directory
get -r /path/to/remote/directory /path/to/local/directory
exit
sudo命令提升权限。通过以上步骤,你可以在CentOS系统中使用SSH进行文件传输。