场景:开发环境下经常需要查看测试环境的服务器情况或者查看LOG
每次登录时都需要输入对应服务器的密码相当麻烦
利用RSA免密登录可以解决这个烦恼
创建本地RSA公私钥
cd ~/.ssh
ssh-keygen -t rsa
本地公钥上传至服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub <user>@<ip>
当出现如下字符即可
ow try logging into the machine, with: "ssh '<user>@<ip>'"
and check to make sure that only the key(s) you wanted were added.
当多个服务器使用同一个RSA公钥时会出现需要输入本地密码才可以
输入如下指令即可
ssh-add -K ~/.ssh/id_rsa