linux – ssh仍然接受密码验证,尽管配置为仅公钥验证(有效!)

前端之家收集整理的这篇文章主要介绍了linux – ssh仍然接受密码验证,尽管配置为仅公钥验证(有效!)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已将Ubuntu 10.04LTS桌面安装配置为仅允许公钥验证.

结果:公钥认证工作完美!

问题:问题是,尽管配置为仅接受公钥认证,客户端仍然接受密码认证 – 为什么?

当然可以使用我看到的一些建议,并遵循这里的建议:ssh: can still use password after setting the key

遵循这些建议后没有成功:

> chmod 700 /home//.ssh
> chmod 600 /home//.ssh/authorized_keys
>添加到/ etc / ssh / ssh_config:

> PasswordAuthentication没有
> ChallengeResponseAuthentication no

> restarted sshd(命令:/usr/sbin / service ssh restart).

客户端的/ etc / ssh / ssh_config读取:

  1. # This is the ssh client system-wide configuration file. See
  2. # ssh_config(5) for more information. This file provides defaults for
  3. # users,and the values can be changed in per-user configuration files
  4. # or on the command line.
  5.  
  6. # Configuration data is parsed as follows:
  7. # 1. command line options
  8. # 2. user-specific file
  9. # 3. system-wide file
  10. # Any configuration value is only changed the first time it is set.
  11. # Thus,host-specific definitions should be at the beginning of the
  12. # configuration file,and defaults at the end.
  13.  
  14. # Site-wide defaults for some commonly used options. For a comprehensive
  15. # list of available options,their meanings and defaults,please see the
  16. # ssh_config(5) man page.
  17.  
  18. Host *
  19. # ForwardAgent no
  20. # ForwardX11 no
  21. # ForwardX11Trusted yes
  22. # RhostsRSAAuthentication no
  23. RSAAuthentication yes
  24. PasswordAuthentication no
  25. PermitRootLogin no
  26. PubKeyAuthentication yes
  27. ChallengeResponseAuthentication no
  28. # HostbasedAuthentication no
  29. # GSSAPIAuthentication no
  30. # GSSAPIDelegateCredentials no
  31. # GSSAPIKeyExchange no
  32. # GSSAPITrustDNS no
  33. # BatchMode no
  34. # CheckHostIP yes
  35. # AddressFamily any
  36. # ConnectTimeout 0
  37. # StrictHostKeyChecking ask
  38. # IdentityFile ~/.ssh/identity
  39. # IdentityFile ~/.ssh/id_rsa
  40. # IdentityFile ~/.ssh/id_dsa
  41. # Port 22
  42. # Protocol 2,1
  43. # Cipher 3des
  44. # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-c bc,3des-cbc
  45. # MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
  46. # EscapeChar ~
  47. # Tunnel no
  48. # TunnelDevice any:any
  49. # PermitLocalCommand no
  50. # VisualHostKey no
  51. SendEnv LANG LC_*
  52. HashKnownHosts yes
  53. GSSAPIAuthentication yes
  54. GSSAPIDelegateCredentials no

我错过了另一种选择吗?也许匹配(虽然这似乎不太可能对我有帮助)?

谢谢.

解决方法

/ etc / ssh / ssh_config用于客户端.您想在服务器配置文件中设置这些选项,即/ etc / ssh / sshd_config.

猜你在找的Linux相关文章