OpenSSH使用遇到的问题

参数写错配置文件

sshd 服务报错如下:

1
2
/etc/ssh/sshd_config: line 43: Bad configuration option: StrictHostKeyChecking
/etc/ssh/sshd_config: line 44: Bad configuration option: UserKnownHostsFile

原因如下:

/etc/ssh/sshd_config 配置文件中添加了如下配置:

1
2
StrictHostKeyChecking no
UserKnownHostsFile /dev/null

说明解释:

上面两个选项是 ssh_config 客户端配置中的,并不是 sshd_config 服务端的配置。因为配置在了错误的配置文件中导致 sshd 服务停止。

可以通过下面命令查看:

1
man ssh_config

StrictHostKeyChecking

​ If this flag is set to no or off, ssh will automatically add new host keys to the user known hosts files and allow connections to hosts with changed hostkeys to proceed, subject to some restrictions.

UserKnownHostsFile
Specifies one or more files to use for the user host key database, separated by whitespace.

通常这两个 ssh 客户端参数组合使用,用来完成 ssh 无口令登录(即通过客户端公钥认证,就可以直接连接到远程主机)。

  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2022-2023 ligongzhao
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信