Operating System - HP-UX
1832938 Members
3400 Online
110048 Solutions
New Discussion

Re: user account doesnt follow nsswitch

 
E Hunter
Occasional Advisor

user account doesnt follow nsswitch

I set up my nsswitch.conf to look for hosts in the /etc/hosts table first, then to check DNS. This works for the root account, but when logged in as any other user nslookup returns:

Using /etc/hosts on: hostname

Is there some sort of switch that can make a user account ignore the /etc/nsswitch.conf directives?

nsswitch.conf is world readable and contains the following line for hosts resolution:

/etc/nsswitch.conf:
hosts: files [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=continue] dns


6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: user account doesnt follow nsswitch

I don't think so.

/etc/nsswitch.conf applies to all users, entire machines.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dwyane Everts_1
Honored Contributor

Re: user account doesnt follow nsswitch

E Hunter,

I'm not sure I correctly understand your question. According to your posting, root and all user accounts act in the same way, in accordance with your nsswitch.conf file. They read /etc/hosts first, then DNS, per your system setup.

One thing that is puzzling to me...why are you using "UNAVAIL" and "TRYAGAIN" with your hosts entry. "NOTFOUND" in this istance I believe would be good enough.

Did I misunderstand something from your posting?

Dwyane
RAC_1
Honored Contributor

Re: user account doesnt follow nsswitch

Do as follows.

nsquery hosts "host_name"

What it returns??

Anil
There is no substitute to HARDWORK
Sridhar Bhaskarla
Honored Contributor

Re: user account doesnt follow nsswitch

Are you sure?. It may say 'Using /etc/hosts on: hostname' but it should subsquently say something like

Using /etc/hosts on: hostname

looking up FILES
Trying DNS
Name: somehost.yourdoman.com
Address: xx.xx.xx.xx

You see the DNS entry there.

Check the permissions on /etc/hosts, /etc/nsswitch.conf and /etc/resolv.conf also.
Make sure users have read permissions to all of them.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
E Hunter
Occasional Advisor

Re: user account doesnt follow nsswitch

found the problem.

Root could resolve, users couldn't. Permissions on /etc/resolv.conf were 600. One chmod go+r /etc/resolv.conf later, we were all happy.
E Hunter
Occasional Advisor

Re: user account doesnt follow nsswitch

permissions weren't right on /etc/resolv.conf