[Samba] getent passwd not showing domain users at boot

Mark Foley mfoley at ohprs.org
Wed Oct 21 05:31:04 UTC 2015


OK, just tried the rc.local script shown below.  It works! It will try for up to
1 minute waiting for the winbind service, then it gives up.  I guess rc.local
has to be a bit patient!

In case you're wonder about the reason for this, I'm creating an autofs map file
of domain users (these have UID:GID 100nn:10000).  I intend to put this script
on all the Linux workstations so whenever a user is added to, or removed from
the AD Domain the workstation will get updated the next time it boots (which is
often enough).  Any Domain user can log onto any office workstation and get
their home directory from the Samba4 server's redirectedFolders.

Thanks for your help!

--Mark

---SNIP---
mapfile=/etc/auto.domUsers

echo Creating $mapfile map for autofs

for (( cnt=0 ; cnt < 6 ; cnt++ ))
do
    x=`service winbind status | grep "start/running"`

    if [ -n "$x" ]      # running
    then
        echo -e "# autofs maps for Domain Users - created" `date "+%Y-%m-%d %H:%M:%S"`"\n" >$mapfile

        /usr/bin/getent passwd | grep ":100..:10000": | \
        while read
        do
            usr=`echo $REPLY | cut -d: -f1`
            echo echo $usr -fstype=nfs,acl,rw mail:/redirectedFolders/Users/$usr >> $mapfile
        done
        break
    else
        sleep 10
    fi
done
---UNSNIP---

-----Original Message-----
From: Mark Foley <mfoley at ohprs.org>
Date: Wed, 21 Oct 2015 00:48:00 -0400
To: samba at lists.samba.org
Subject: Re: [Samba] getent passwd not showing domain users at boot

I added `service winbind status` to the beginning of my rc.local script and,
after booting, saw the message: "winbind stop/waiting".

So you're right, winbind is not running.

Hmmm, I thought rc.local was the last thing to run at boot time. winbindd is run
as a daemon, so I suppose rc.local could run before winbind has a chance to get
all its ducks in a row.

I'll try looping in rc.local for a while waiting for winbind to start.

--Mark

-----Original Message-----
> To: <samba at lists.samba.org>
> From: Ole Traupe <ole.traupe at tu-berlin.de>
> Date: Tue, 20 Oct 2015 16:36:56 +0200
> Subject: Re: [Samba] getent passwd not showing domain users at boot
>
> You could als do a "service winbind status".
>
>
> Am 20.10.2015 um 12:49 schrieb mathias dufresne:
> > Mark,
> >
> > As you try to extract all users from AD and as it is not always advisable I
> > would try into your rc script to retrieve only one user at boot time, just
> > to check if winbind is not working at all at that moment or if it refuse to
> > extract all domain users at that moment...
> >
> > Cheers,
> >
> > mathias
> >
> > 2015-10-20 10:18 GMT+02:00 Ole Traupe <ole.traupe at tu-berlin.de>:
> >
> >> Mark, did you make sure winbind service is startet, yet?
> >>
> >> Ole
> >>
> >>
> >> Am 19.10.2015 um 20:41 schrieb Mark Foley:
> >>
> >>> I've joined a member server to my Samba4 AD/DC Domain. It all works
> >>> great,but I
> >>> have one minor problem at the moment. At boot-time, I want a list of
> >>> domain
> >>> users. In my /etc/rc.local script I have:
> >>>
> >>> /usr/bin/getent passwd > /etc/auto.domUsers 2>&1
> >>>
> >>> This runs, but none of the domain users are listed, only local users.
> >>> When I log
> >>> in and run `getent passwd` from the command line. I see all the configured
> >>> domain users.
> >>>
> >>> What's the problem? Does the member server not have access to the domain
> >>> information for some period of time after booting? rc.local is supposedly
> >>> the
> >>> last start-up script to run.
> >>>
> >>> AD/DC runs Samba 4.1.17.
> >>>
> >>> member server is Ubuntu 14.04.3
> >>>
> >>> THX - Mark
> >>>
> >>>
> >> --
> >>
> >> Dr. Ole Traupe
> >>
> >> Lab Manager
> >>
> >> Technische Universität Berlin
> >> Biopsychologie und Neuroergonomie
> >> Institut für Psychologie und Arbeitswissenschaft
> >>
> >> Biological Psychology and Neuroergonomics
> >> Department of Psychology and Ergonomics
> >>
> >> Postanschrift/Mail to:
> >>
> >> TU Berlin
> >> Sekr. MAR 3-2
> >> Marchstr. 23
> >> 10587 Berlin
> >> GERMANY
> >>
> >> Zimmer/Office: MAR 3.052
> >> Telefon/Phone: (+49) 030 314 22721
> >> Fax: (+49) 030 314 25274
> >>
> >> E-Mail: ole.traupe at tu-berlin.de
> >> www.bpn.tu-berlin.de
> >>
> >>
> >>
> >>
> >>
> >> --
> >> To unsubscribe from this list go to the following URL and read the
> >> instructions:  https://lists.samba.org/mailman/options/samba
> >>
>
> -- 
>
> Dr. Ole Traupe
>
> Lab Manager
>
> Technische Universität Berlin
> Biopsychologie und Neuroergonomie
> Institut für Psychologie und Arbeitswissenschaft
>
> Biological Psychology and Neuroergonomics
> Department of Psychology and Ergonomics
>
> Postanschrift/Mail to:
>
> TU Berlin
> Sekr. MAR 3-2
> Marchstr. 23
> 10587 Berlin
> GERMANY
>
> Zimmer/Office: MAR 3.052
> Telefon/Phone: (+49) 030 314 22721
> Fax: (+49) 030 314 25274
>
> E-Mail: ole.traupe at tu-berlin.de
> www.bpn.tu-berlin.de
>
>
>
>
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba




More information about the samba mailing list