本文记录ssh免密码登陆的命令,主要作为备忘
远程主机ip:RemoteHostIpAddress
1.生成key
如果本地有id_rsa和id_rsa.pub这两个文件就不要再生成一次了,否则之前已经设置好的网站就白弄了。
ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment] [-f output_keyfile]
ssh-keygen -t rsa
2.把公钥id_rsa.pub拷到远程主机上面去
scp /.ssh/id_rsa.pub user@RemoteHostIpAddress:~/.ssh/ir.pub (这里没用id_rsa.pub是因为防止把远程主机上的公钥覆盖)