[Samba] %g variable not working

Noah Dain noahdain at gmail.com
Thu Aug 18 18:24:46 GMT 2005


On 8/17/05, Gerald (Jerry) Carter <jerry at samba.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Saravanan wrote:
> > Hi,
> >
> > I am trying to assign policies for groups. I am using
> > the following netlogon configuration.
> >
> > [netlogon]
> >       path = /usr/local/samba/lib/%g/netlogon
> >       browseable = No
> >
> > it works fine with
> >
> > [netlogon]
> >       path = /usr/local/samba/lib/%u/netlogon
> >       browseable = No
> 
> I can't reproduce this against the current SAMBA_3_0 code.
> %g works fine.  Perhaps the client is caching a connection
> to the [netlogon] share.

I'm seeing similar things also, with stock debian sarge.  Samba is an
AD member via winbind.  It is also the master browser on the network.

I am trying to run a script to create per machine user profiles (for
sites where client machines are non-homogenous).  The paths created
would be something like /home/DOMAIN/netbios-name/user-name.  I've
been tinkering on it for a little while now, but not getting anywhere,
although at times I will get blank variables passed in, iirc depending
upon what samba variables I use.

I pass several variables to the script from samba.

--- start script ---
#!/bin/sh
# create user home directories upon first connection to service

# $1 == DOMAIN "%D"
# $2 == username (%U or %u)
# $3 == primary group (%G or %g)
# $4 == netbios computer name (%m)
# $5 == dns computer name (%M)
# $6 == client ip address (%I)

PATH=/bin:/usr/bin:/sbin:/usr/sbin
LOGFILE=/tmp/mksmbdir.txt
SAMBASCRIPTSDIR=/etc/samba/scripts
REVDNSLOOKUPCMD="$SAMBASCRIPTSDIR/dnsrevlookup.py $6"
DEBUG=1

HRT="/home"
HRTDOM="$HRT/$1"
HRTDOMCMP="$HRTDOM/`$REVDNSLOOKUPCMD`"
HRTDOMCMPUSR="$HRTDOMCMP/$2"

if [ $DEBUG == 1 ]; then
    echo "path: $PATH" > $LOGFILE
    echo "logfile: $LOGFILE" >> $LOGFILE
    echo "DOMAIN: "$1"" >> $LOGFILE
    echo "USER: "$2"" >> $LOGFILE
    echo "PRIMARY GROUP: $3" >> $LOGFILE
    echo "CLIENT NETBIOS NAME: "$4"" >> $LOGFILE
    echo "CLIENT DNS NAME: $5" >> $LOGFILE
    echo "CLIENT IP ADDRESS: $6" >> $LOGFILE
    echo "hrt: "$HRT"" >> $LOGFILE
    echo "hrtdom: "$HRTDOM""  >> $LOGFILE
    echo "hrtdomcmp: "$HRTDOMCMP""  >> $LOGFILE
    echo "hrtdomcmpusr: "$HRTDOMCMPUSR""  >> $LOGFILE
fi
[ mkdir stuff down here ... ]
--- end script ---

This script is called via:

[homes]
        comment = %U's Home Directory
        path = /home/%D/%M/%U
        valid users = %D+%S
        read only = No
        browseable = No
        root preexec = /etc/samba/scripts/mk_sambadir %D "%U" "%G" %m %M %I

I even tried using a reverse lookup script for the hostname, but that
only gets the proper directory path created, one that Samba is unaware
of.

Here's the debug output from the script when a new user logs into a
machine, using a domain account for the first time:

--- start debug output ---
path: /bin:/usr/bin:/sbin:/usr/sbin
logfile: /tmp/mksmbdir.txt
DOMAIN: SYSGEN
USER: ndain
PRIMARY GROUP: administrators
CLIENT NETBIOS NAME: 192.168.1.103
CLIENT DNS NAME: 192.168.1.103
CLIENT IP ADDRESS: 192.168.1.103
hrt: /home
hrtdom: /home/SYSGEN
hrtdomcmp: /home/SYSGEN/cyclops.sysgen
hrtdomcmpusr: /home/SYSGEN/cyclops.sysgen/ndain
--- end debug output ---



--
Noah Dain
noahdain at gmail.com


More information about the samba mailing list