Fixing Hostname Resolution for Non-Root UsersThe ProblemRecently I found myself unable to connect to hosts by hostname. Ping, telnet, applications, all failed to resolve hostnames. Attempts resulted in errors like:
Next I tried resolving hostnames as root. It worked! That led me to
research problems affecting only non-root users. The answer, it
turned out, was file permissions on The SolutionFor non-root users to resolve hostnames,/etc/resolv.conf
and /etc/nsswitch.conf must be world-readable.
So, as root, run these commands: chmod a+r /etc/resolv.conf chmod a+r /etc/nsswitch.conf Now try pinging by hostname from a regular user. It should work. Copyright © 2020 Andrew Oliver |