Re: NIS and autofs and /net

From: P.T. Breuer (ptb_at_oboe.it.uc3m.es)
Date: 02/21/04


Date: Sat, 21 Feb 2004 20:03:35 +0100

Rick Denoire <100.17706@germanynet.de> wrote:
> ptb@oboe.it.uc3m.es (P.T. Breuer) wrote:
>
>>Rick Denoire <100.17706@germanynet.de> wrote:
>>> I incorporated a Linux client into a Sun NIS domain, "seems" to work.
>>> According to the Redhat instructions (using RH AS 2.1), one has to add
>>> a line to the client's /etc/passwd file like this:
>>> +::::::
>>> (I put it at the beginning).
>
>>Noooooo! It has to go at the END!!! That's where the nis maps are
>>inserted! You don't want them to override your own local entries!
>
> I have the line in the /etc/nsswitch.conf:
> passwd: files nis

It does no good there (well, not much). The lookup in files
(/etc/passwd) will already drag in the nis map that you have referenced
at the *head* of /etc/passwd (modulo provisos ..). You want just
"compat" (which is the default if you just blatt that file away, which
you should probably do ...). Well ... it's not clear from the manpage.
I leave you to judge:

      Linux libc5 without NYS does not have the name service
       switch but does allow the user some policy control. ...
       Since most people only put a + at the end of /etc/passwd to
                                             ^^^^
       include everything from NIS, the switch provides a faster
       alternative for this case (`passwd: files nis') which doesn't
       require the single + entry in /etc/passwd, /etc/group and
       ^^^^^^^^
       /etc/shadow. If this is not sufficient, the NSS `compat' service
       provides full +/- semantics. By default, the source is `nis',
       but this may be overriden by specifying `nisplus' as source for
       the pseudo-databases passwd_compat, group_compat and
       shadow_compat. This pseudo-databases are only available in GNU C
       Library.

In other words, what you have done is undefined behaviour. If you want
to lookup first in passwd and then in nis, you should EITHER have
compat as the mode in nsswitch and a +::::: at the END of passwd, OR
you should NOT have a +::::: line in passwd, but INSTEAD a "files nis"
line in nsswitch.

> So everything that is found in the file won't be read von a NIS map.
> But you might be right if the +:::::: entry renders the local file
> unread, so I will follow your advise.

>>You will have to use an automounter that can read sun automount maps.
>>
> Noooooo! The map entry in the client's auto.master file says:
> /net program:/etc/auto_net

"program:"? Eh what? That's not normal syntax. Linux auto.master files
look like

   /- /etc/auto.bin -t 5

(that is a program entry). It's deemed to be a program if the
referenced file is executable.

> which means that no map file will be used from NIS

It means nothing of the sort. It simply says "look in the local file,
and if it's executable, run it insted of looking in it". What the
local executable does is up to it, and may well involve doing a ypcat
of some nis map.

> but the local one,
> and that it is an executable delivering necessary information for the
> automounter to do its work.

It's not in any syntax that matches any man page I own.
(auto.master(5))

       The file has three fields separated by an arbitrary number
       of blanks or tabs. Lines beginning with # are comments.
       The first field is the mount point. Second field is the
       map file to be consulted for this mount-point. The third
       field is optional and can contain options to be applied to
       all entries in the map. Options are cumulative, which is a
       difference to the behavior of the SunOS automounter.

> The line:
> automount: files nis
> says explicitely "read the local map files first".

Uh, since when does your automount daemon pay any attention to
nsswitch? When the automount daemon is started, it is given its
arguments from lines in auto.master by the init script. Anyway,
that script is responsible for the interpretation of auto.master.
If you don't like its interpretation, rewrite the script. Its
job is to end up by starting

    automount /- program /etc/auto.bin -t 5

(in the example I gave), and the init script will deduce that the map
type is "program" by noticing the x bit on the perms of auto.bin. Or at
least my startup script will! You can rewrite yours to do what you
please! If you figure out how to make it look in nsswitch.conf, tell
me.

> Since the map file
> for /net exists locally, it won't be taken from NIS and so it does not
> need to be understood by the Linux automounter.

Eh? All this is fantasy, unless you have some different automount
program than me! You may well have!

       automount takes at least three arguments. Mandatory argu
       ments include mount-point, map-type and map. Both manda
       tory and optional arguments are described below...

> What you say is true though, for map files coming from NIS. The
> original entry in the Sun NIS server:
> /net -hosts
> could not be understood by the Linux server, if it was used.
>
> If I want to avoid a NIS map file to be used, I need only to put a
> local one in /etc.

Nope. You simply have to stop believing in magic, and instead provide a
causal chain to support your reasoning. I'm willing to believe you have
a new singing dancing automount program that is different to mine, but
you could provide evidence to back up your belief!

Peter



Relevant Pages

  • Re: [SLE] autofs starts auto.local but not in auto.master
    ... This line in auto.master tells autofs to ... /n is the mount point, yp is the type of automount map ... and auto.local is the name of the NIS map. ...
    (SuSE)
  • Re: Automounter map changes
    ... > I have setup the automount using NIS. ... > The client has mounted the above export. ... > and then rebuild and push the NIS map. ...
    (comp.unix.aix)
  • Re: NIS And /home Dirs On Client Systems
    ... NIS is just a directory service of sorts. ... Creating homedirs on the fly is ... That's why pam_mkhomedir cannot change a homedir if the NIS map ... And in fact NIS client don't know about changes in the NIS ...
    (Debian-User)
  • Re: Following directions doesnt seem to work: Adding users in NIS
    ... automated way of adding users to a NIS map, ... your NIS master file, and rebuild the maps. ... Do I also need to modify the copy of passwd or is master.passwd the only ...
    (freebsd-questions)
  • Re: Setting the entry order in a NIS group file
    ... > know how to force a specific order from the NIS source files? ... That's because the NIS map is a database file that's queried by the yp ... matter unless you wrote a badly designed application where it does. ... DeeDee, don't press that button! ...
    (comp.sys.sun.admin)