Setting UseDNS in sshd_conf

JustSomeGuy

Active Member
Oct 13, 2007
30
0
56
I was wondering if anyone could shed some light on this issue.
In cPHulk, it says "UseDNS was detected as being enabled for SSHD which causes problems with whitelisting IPs for cPHulkd. UseDNS has been set to "no" to prevent issues."
My problem is that inside sshd_conf, it sets it to: UseDNS no
When I try to restart sshd, I get the following:
/etc/ssh/sshd_config: line 99: Bad configuration option: UseDNS
/etc/ssh/sshd_config: terminating, 1 bad configuration options

At that time, sshd will not restart.
Any ideas???
Thanks in advance
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello :)

I have seen some cases where custom entries to the /etc/ssh/sshd_config file have resulted in the error message that you reported. Could you let us know what Operating System you are using? You can check this with a command such as:

Code:
# cat /etc/redhat-release
Also, you may want to try using a known default /etc/ssh/sshd_config file and then making the change again to see if it allows SSH to restart normally.

Thank you.
 

JustSomeGuy

Active Member
Oct 13, 2007
30
0
56
CentOS release 5.9 (Final)
The only change that I have done is:
Port ??? I've set the port to a different one to hide
Protocol 2

As for the default file, do you know where I could fine one?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
You could simply remove the "UseDNS" line completely, as it appears your version of OpenSSH does not support it.

Thank you.
 

JustSomeGuy

Active Member
Oct 13, 2007
30
0
56
Yes I do remove it but at times, when updates are done, it will add that line to the config file and I can not login. Just frustrating
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Could you open a support ticket so we can address this issue and open an internal case if necessary?

Submit A Ticket

Please post the ticket number here so we can track the issue.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
To update, it was determined in the ticket that the OpenSSH RPMs installed on this server were not the standard ones provided on CentOS machines. The error message reported appears to have been related to that, as it was not reproducible in a similar test environment.

Thank you.
 

georgeb

Well-Known Member
May 23, 2010
49
1
58
Montreal, QC, Canada
cPanel Access Level
Root Administrator
You can simply do: (until you have a solution from cPanel):

chattr +i /etc/ssh/sshd_config

and updates can't change anymore this

or add a line to /scripts/postupcp and remove the line containing UseDNS (using sed command, and restart sshd service)

Regards
 

cPanelPeter

Technical Analyst III
Staff member
Sep 23, 2013
575
21
143
cPanel Access Level
Root Administrator
Twitter
Hello,

I do not recommend setting the immutable bit on any files. This can cause all kinds of problems within cPanel/WHM.
As cPanelMichael already stated, this usually means your OS is running a version of OpenSSH that does not understand the UseDNS option.

We know CentOS uses RPM's for OpenSSH that will accept UseDNS configuration options, so if you're running another OS, you need to make sure that the UseDNS option is available. (it is in most modern operating systems).