[SSH 免密登录]

生成秘钥:
$ ssh-keygen -t rsa -P ''  # 在当前用户根目录下生成.ssh文件夹(两个单引号)

.ssh

----id_rsa
----id_rsa.pub
 
在.ssh文件夹下新建authorized_keys, 把id_rsa.pub中的内容复制进去
$ touch .ssh/authorized_keys

修改.ssh和authorized_keys文件属性

$ chmod 700 .ssh/
$ chmod 600 authorized_keys
 如果还是没有成功,修改:
$ vim /etc/ssh/sshd_config 
 
#将如下两句的注释去掉
RSAAuthentication yes
PubkeyAuthentication yes

PS:登录不上哪台机器,就检查那台机器配置

 

猜你喜欢

转载自www.cnblogs.com/x-you/p/10514088.html