Centos

/etc/ssh/sshd_config:第 43 行:錯誤的配置選項:StrictHostKeyChecking

  • September 23, 2020

我的/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

這是一個選項ssh_config(注意沒有 d)

man ssh_config

StrictHostKeyChecking 如果此標誌設置為 yes,ssh(1) 將永遠不會自動將主機密鑰添加到 ~/.ssh/known_hosts

您在連接時檢查主機密鑰,而不是在接收傳入連接時檢查。

引用自:https://unix.stackexchange.com/questions/610871