ssh连接远程服务器小技巧

正常,每次连接远程服务器都要1 ssh remotehost; 2 输入密码

其实,可以通过配置~/.ssh/config来简化步骤一,例如这样

Host corp
     User user
     HostName 192.168.xxx.xxx
     Port 22
     ServerAliveInterval 120
     ServerAliveCountMax 30
     IdentityFile ~/.ssh/id_rsa


以后就可以直接 ssh corp而不用输入冗长的ip地址。


其二,将自己的公钥即id_rsa.pub里的东西考到服务器的~/.ssh/authorized_keys里面以后就不用输入密码了。

猜你喜欢

转载自blog.csdn.net/cscj2010/article/details/41011613