某天突然聽到同事說服務器上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服務器的配置文件,二者區別在於,前者是針對客戶端的配置文件,后者則是針對服務端的配置文件。兩個配置文件都允許通過設置不同的選項來改變客戶端程序的運行方式。