微信登录

自带软件 - SSH - sshd_config - 服务器端配置文件

/etc/ssh/sshd_config 文件

查看sshd_config

  1. cat /etc/ssh/sshd_config
  1. # This is ssh server systemwide configuration file.
  2. Port 22
  3. ListenAddress 192.168.1.1
  4. HostKey /etc/ssh/ssh_host_key
  5. ServerKeyBits 1024
  6. LoginGraceTime 600
  7. KeyRegenerationInterval 3600
  8. PermitRootLogin no
  9. IgnoreRhosts yes
  10. IgnoreUserKnownHosts yes
  11. StrictModes yes
  12. X11Forwarding no
  13. PrintMotd yes
  14. SyslogFacility AUTH
  15. LogLevel INFO
  16. RhostsAuthentication no
  17. RhostsRSAAuthentication no
  18. RSAAuthentication yes
  19. PasswordAuthentication yes
  20. PermitEmptyPasswords no
  21. AllowUsers admin

下面逐行说明上面的选项设置:

  1. # This is ssh server systemwide configuration file.
  2. Port 22 设置sshd监听的端口号
  3. ListenAddress 192.168.1.1 设置sshd服务器绑定的IP地址
  4. HostKey /etc/ssh/ssh_host_key 设置包含计算机私人密匙的文件
  5. ServerKeyBits 1024 定义服务器密匙的位数
  6. LoginGraceTime 600 设置如果用户不能成功登录,在切断连接之前服务器需要等待的时间(以秒为单位)
  7. KeyRegenerationInterval 3600 设置在多少秒之后自动重新生成服务器的密匙(如果使用密匙)
  8. KeyRegenerationInterval 3600 重新生成密匙是为了防止用盗用的密匙解密被截获的信息
  9. PermitRootLogin no 设置是否允许root通过ssh登录
  10. PermitRootLogin no 这个选项从安全角度来讲应设成"no"
  11. IgnoreRhosts yes 设置验证的时候是否使用“rhosts”和“shosts”文件
  12. IgnoreUserKnownHosts yes 设置ssh daemon是否在进行RhostsRSAAuthentication安全验证的时候忽略用户的"$HOME/.ssh/known_hosts"
  13. StrictModes yes 设置ssh在接收登录请求之前是否检查用户家目录和rhosts文件的权限和所有权。
  14. StrictModes yes 这通常是必要的,因为新手经常会把自己的目录和文件设成任何人都有写权限。
  15. X11Forwarding no 设置是否允许X11转发
  16. PrintMotd yes 设置sshd是否在用户登录的时候显示“/etc/motd”中的信息
  17. SyslogFacility AUTH 设置在记录来自sshd的消息的时候,是否给出“facility code
  18. LogLevel INFO 设置记录sshd日志消息的层次。
  19. LogLevel INFO INFO是一个好的选择。查看sshdman帮助页,已获取更多的信息。
  20. RhostsAuthentication no 设置只用rhosts或“/etc/hosts.equiv”进行安全验证是否已经足够了
  21. RhostsRSAAuthentication no 设置是否允许用rhosts或“/etc/hosts.equiv”加上RSA进行安全验证
  22. RSAAuthentication yes 设置是否允许只有RSA安全验证
  23. PasswordAuthentication yes 设置是否允许口令验证
  24. PermitEmptyPasswords no 设置是否允许用口令为空的帐号登录
  25. AllowUsers admin 后面可以跟任意的数量的用户名的匹配串,这些字符串用空格隔开。主机名可以是域名或IP地址