2024年6月9日发(作者:)

OpenSSH在Red Hat Linux企业级版本中是默认安装的,一般的安装目录为

/etc/ssh,对应的服务器配置文件为/etc/ssh/sshd_config。我们重点讲述这个配置文件

中每个选项的含义。

2.

1. [root@localhost ~]# vi /etc/ssh/sshd_config

2. Port 22

3. ("Port"用来设置sshd监听的端口,这里采用的是默认的端口号22)

4. #Protocol 2,1

5. (设置使用的ssh协议为ssh1或ssh2,如果仅仅使用ssh2,

设置为Protocol 2即可)

6. #ListenAddress 0.0.0.0

7. ("ListenAddress"用来设置sshd服务器绑定的IP地址)

8. # HostKey for protocol version 1

9. #HostKey /etc/ssh/ssh_host_key

10. # HostKeys for protocol version 2

11. #HostKey /etc/ssh/ssh_host_rsa_key

12. #HostKey /etc/ssh/ssh_host_dsa_key

13. ("HostKey"用来设置服务器密匙文件的路径)

14. #KeyRegenerationInterval 1h

15. ("KeyRegenerationInterval"用来设置在多少秒之后

系统自动重新生成服务器的密匙(如果使用密匙)。重新生成

密匙是为了防止利用盗用的密匙解密被截获的信息)

16. #ServerKeyBits 768

17. ("ServerKeyBits"用来定义服务器密匙的长度)

18. SyslogFacility AUTHPRIV

19. ("SyslogFacility"用来设定在记录来自sshd的消息的时候,

是否给出"facility code")