配置ssh config并使用别名快速登陆

编辑文件:~/.ssh/config?或/etc/ssh/ssh_config
Host host1
  Hostname host
  Port 2222
Host host2
  Hostname host
  Port 2223

或者
Host nas01
     HostName 192.168.1.100
     User root
     IdentityFile ~/.ssh/nas01.key

然后可以用

scp host1:/backup/files host2:/backup/cluster1
登陆 设置别名后,可以用命令scp -3从B机器将A机器上的文件传输到C机器
scp -3 A:file C:file
参考:

https://superuser.com/questions/1086849/how-to-be-made-secure-copying-between-remote-machines-on-different-ports-by-loca

https://superuser.com/questions/276533/scp-files-via-intermediate-host

发表评论