使用ssh config管理远程登录

1. 首先在客户机生成密钥

ssh-keygen -t rsa

2. 将生成公钥文件id_rsa.pub中的内容拷贝到服务器的.ssh/authorized_keys文件中

3. 修改客户机~/.ssh/config中的配置内容如下

Host seoul
Hostname    xxx.xxx.xxx
Port    22
User    ubuntu
IdentityFile    ~/.ssh/id_rsa_seoul

Host tx01
Hostname    xxx.xxx.xxx.xxx
Port    22
User    ubuntu
IdentityFile    ~/.ssh/id_rsa

之后要登录远程服务器只需要输入类似的命令 ssh tx01

posted @ 2018-04-10 02:04  doublerain  阅读(248)  评论(0编辑  收藏  举报