1.生成公钥和私钥:
[pw@hadoop010 ~]$ ssh-keygen -t rsa
然后敲(三个回车),就会生成两个文件id_rsa(私钥)、id_rsa.pub(公钥
2.将公钥拷贝到要免密登录的目标机器上
[pw@hadoop010 .ssh]$ ssh-copy-id hadoop010
[pw@hadoop010 .ssh]$ ssh-copy-id hadoop011
[pw@hadoop010 .ssh]$ ssh-copy-id hadoop012
3..ssh文件夹下(~/.ssh)的文件功能解释
known_hosts | 记录ssh访问过计算机的公钥(public key) |
---|---|
id_rsa | 生成的私钥 |
id_rsa.pub | 生成的公钥 |
authorized_keys | 存放授权过得无密登录服务器公钥 |