从一台centos服务器登录另外一台centos服务器 ssh

发布时间 2023-03-24 22:30:50作者: emanlee

从一台centos服务器登录另外一台centos服务器(使用私钥)

centos7一台服务器登录另一台服务器并退出

 

ssh root@192.168.118.128

ls /etc/ssh
moduli      sshd_config         ssh_host_ecdsa_key.pub  ssh_host_ed25519_key.pub  ssh_host_rsa_key.pub
ssh_config  ssh_host_ecdsa_key  ssh_host_ed25519_key    ssh_host_rsa_key


通过ssh远程执行命令
例如:        ssh root@192.168.118.128 pwd (查看root用户所在路径)


SSH 默认连接到目标主机的 22 端口上,可以使用-p选项指定端口号
$ ssh -p 10022 user@hostname


 

 

 https://linuxhint.com/ssh-using-private-key-linux/

 

chmod 600 zn3_key

ssh -p 313 -i zh_key  zh@3.14

ssh -p 端口 -i 私钥  用户名@ip