[Samba] Samba 4, where is wbinfo 'info' stored?

steve steve at steve-ss.com
Mon Feb 13 12:24:43 MST 2012


On 02/13/2012 08:03 PM, steve wrote:
> On 02/13/2012 07:53 PM, Gémes Géza wrote:
>> Hi,
>>
>> See comments/questions below:
>>> Hi
>>>
>>> When I type this:
>>> getent passwd steve6
>>> steve6:*:3000015:3000016:steve6:/home/CACTUS/steve6:/bin/bash
>>> I can see that the info is coming from LDAP by looking at the ldif for
>>> cn=steve6
>> What is your /etc/nsswitch.conf file like?
> passwd files ldap
> group files ldap
>>> When I type this:
>>> wbinfo -i steve6
>>> CACTUS\steve6:*:3000015:3000016::/home/CACTUS/steve6:/bin/false
>> Is this on the samba4 box?
>> wbinfo is the samba4 wbinfo or a samba3 one?
> samba4 box
> wbinfo = samba4 No s3 installed on this box.
>>> Where is the info coming from now?
>>> Thanks,
>>> Steve
>> Regards
>>
>> Geza
>  Everything is OK. Login and uid:gid mapping are fine on both Linux 
> and win7 clients. I'm just trying to script all this from the Linux 
> side without having to tie up a win7 box to do it.
>
> The other thread explains why I know there must be a difference 
> between wbinfo and getent:
>
> Re: [Samba] samba-tool set default group
> Cheers,
BTW here are the posix scripts based on Geza's idea. Saves a helluva lot 
of fiddling:
_But_ I need primaryGroupID to complete the user script. Hence this thread.

cat s4group
#!/bin/sh
echo "Creating s4 posix group "$1
samba-tool group add $1
strgid=$(wbinfo --group-info=$1)
gid=$(echo $strgid | cut -d ":" -f 3)
echo "dn: cn=$1,cn=Users,dc=hh3,dc=sit
changetype: modify
add: objectclass
objectclass: posixaccount
-
add:objectclass
objectclass: posixGroup
-
add: gidnumber
gidnumber: $gid" > /tmp/$1
ldapmodify -h 192.168.1.3 -D cn=Administrator,cn=Users,dc=hh3,dc=site -f 
/tmp/$1 -Y GSSAPI
rm /tmp/$1
echo $1 "posix-ified"

e.g.
./s4group suseusers

cat s4user (needs the primaryGroupID adding to it)
#!/bin/sh
echo "Creating s4 posix user "$1
echo "Pls enter pwd for "$1
samba-tool user add $1
struid=$(wbinfo -i $1)
uid=$(echo $struid | cut -d ":" -f 3)
strgid=$(wbinfo --group-info=$2)
gid=$(echo $strgid | cut -d ":" -f 3)
echo "dn: cn=$1,cn=Users,dc=hh3,dc=site
changetype: modify
add: objectclass
objectclass: posixaccount
-
add: uidnumber
uidnumber: $uid
-
add: gidnumber
gidnumber: $gid
-
add:unixhomedirectory
unixhomedirectory: /home/CACTUS/$1
-
add: loginshell
loginshell: /bin/bash" > /tmp/$1
ldapmodify -h 192.168.1.3 -D cn=Administrator,cn=Users,dc=hh3,dc=site -f 
/tmp/$1 -Y GSSAPI
samba-tool group addmembers $2 $1
mkdir /home/CACTUS/$1
chown $1:$2 /home/CACTUS/$1
rm /tmp/$1
echo $1 "posix-ified"

e.g.
./s4user steve6 suseusers




More information about the samba mailing list