/etc/ssh/sshd_config:第 43 行:错误的配置选项:StrictHostKeyChecking

/etc/ssh/sshd_config:第 43 行:错误的配置选项:StrictHostKeyChecking

/etc/ssh/sshd_config设置的StrictHostKeyChecking = no则无法启动:

StrictHostKeyChecking no

我的 sshd 版本是:

[root@localhost ~]# sshd --version
unknown option -- -
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]
            [-E log_file] [-f config_file] [-g login_grace_time]
            [-h host_key_file] [-o option] [-p port] [-u len]

出现错误:

Sep 23 04:32:47 localhost sshd: /etc/ssh/sshd_config: line 43: Bad configuration option: StrictHostKeyChecking
Sep 23 04:32:47 localhost sshd: /etc/ssh/sshd_config: terminating, 1 bad configuration options
Sep 23 04:32:47 localhost systemd: sshd.service: main process exited, code=exited, status=255/n/a
Sep 23 04:32:47 localhost systemd: Failed to start OpenSSH server daemon.
Sep 23 04:32:47 localhost systemd: Unit sshd.service entered failed state.
Sep 23 04:32:47 localhost systemd: sshd.service failed.

我的服务器是CentOS 7.7

答案1

这是一个选项ssh_config(注意没有 d)

man ssh_config

StrictHostKeyChecking 如果此标志设置为 yes,ssh(1) 将永远不会自动将主机密钥添加到 ~/.ssh/known_hosts

您在连接时检查主机密钥,而不是在接收传入连接时检查主机密钥。

相关内容