ssh: Bad configuration option: usedns

某天突然听到同事说服务器上git用不了了,上去一看,确实用不了了,git pull报出了如下错误:

$ git pull
/etc/ssh/ssh_config: line 56: Bad configuration option: usedns
/etc/ssh/ssh_config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

看到了是ssh配置导致的错误,并且关键词为:“usedns”,然后想起来,今天是有另一个同事为了加速ssh登陆改了一下这个配置。于是将/etc/ssh/ssh_config中的UseDNS改为了yes,并重启了ssh。

但是很遗憾,问题仍旧存在,于是查看了ssh_config配置手册

$ man ssh_config
NAME
     ssh_config — OpenSSH SSH client configuration files

SYNOPSIS
     ~/.ssh/config
     /etc/ssh/ssh_config

全局搜索ssh_config发现并没有UseDNS的配置,然后详细的看了下同事更改配置的说明是修改了/etc/ssh/sshd_config,然后再查看sshd_config的手册:

$ man sshd_config
NAME
     sshd_config — OpenSSH SSH daemon configuration file

SYNOPSIS
     /etc/ssh/sshd_config

果然在sshd_config配置中搜索到了UseDNS配置,所以很明显是同事配置各个服务器的时候,手误了,误把sshd_config里的配置改到了ssh_config,进而导致了上述问题。将UseDNS的配置改到了/etc/ssh/ssh_config之中果然就好了。

另外可以说一下,ssh_config和sshd_config的区别:ssh_config和sshd_config都是ssh服务器的配置文件,二者区别在于,前者是针对客户端的配置文件,后者则是针对服务端的配置文件。两个配置文件都允许通过设置不同的选项来改变客户端程序的运行方式。

猜你喜欢

转载自www.cnblogs.com/minglee/p/11210203.html