如何ssh免秘钥登录在这里就不提了,网上很多,这里说明下,设置免秘钥登录后,仍然不能免秘钥登录的问题。

因为sshd为了安全,对属主的目录和文件权限有所要求。如果权限不对,则ssh的免密码登陆不生效。
用户目录权限为 755 或者 700,就是不能是77x、777,需要保障other用户不能有w权限
.ssh目录权限一般为755或者700。
rsa_id.pub 及authorized_keys权限一般为644
rsa_id权限必须为600

例如:

.ssh目录权限

drwx------   2 root root       4096 Apr  9  2015 .ssh

.ssh目录下文件的权限

-rw-r--r--   1 root root 1609 Mar  2 14:05 authorized_keys
-rw-------   1 root root 1675 Dec 12  2014 id_rsa
-rw-r--r--   1 root root  405 Dec 12  2014 id_rsa.pub
-rw-r--r--   1 root root 4701 May 25  2016 known_hosts

这里的权限指的是对端的权限,如从A主机 通过ssh连接 B主机,B主机权限按照上边的设置进行。

相关文章:

  • 2022-01-21
  • 2021-10-12
  • 2021-10-13
  • 2021-11-02
  • 2022-02-01
  • 2022-01-17
猜你喜欢
  • 2021-11-04
  • 2021-09-29
  • 2021-08-30
  • 2022-02-07
  • 2021-12-05
  • 2021-06-22
相关资源
相似解决方案