ssh配置无密码登录
Posted 码农
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh配置无密码登录相关的知识,希望对你有一定的参考价值。
1.在master机器上生成公钥:
[[email protected] ~]# ssh-keygen -t rsa 注:一直按enter键就可以生成了
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
81:39:eb:23:2c:f9:75:af:93:cb:76:00:87:3e:cf:0f [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
| |
| o |
| +.. |
| oo.. |
| ..oS |
| o .o . |
| o o ++Eo |
| o o +*o. |
| . .+*o |
+-----------------+
2..执行 cp id_rsa.pub authorized_keys
3.把master上面的authorized_keys文件复制到Slave机器上
scp authorized_keys slave:~/.ssh
4..slave1上的修改.ssh目录的权限以及authorized_keys 的权限(这个必须修改,要不然还是需要密码)
以上是关于ssh配置无密码登录的主要内容,如果未能解决你的问题,请参考以下文章