[Samba] LDAP: get samba user sid

Tony Earnshaw tonye at billy.demon.nl
Sat Mar 26 22:21:49 GMT 2005

stephane durieux:

> so as to populate a ldap backend database (samba SID field in
> sambaSamaccount class) I need to get samba users SID, I ve tried net
> usersidlist but it doesn t give anything (it seems to be usefull only with
> winbind) , can someone help me

I don't really understand what you're asking, since you are expressing two
conflicting aims.

However, you can /generate/ a sambaSID (and a lot of other attributes) by
running 'smbpasswd -a whicheveruid' against a posixAccount uid that you've
already made.

You can /get that SID/ using "ldapsearch -LLL -x 'uid=whicheveruid'
sambaSID | awk '/sambaSID/ { print $2 }'" and incorporating that in a
shell script to do whatever you want with it. "pdbedit -Lv whicheveruid |
awk '/User SID:/ { print $3 }'" will also do it.



mail: tonye at billy.demon.nl

More information about the samba mailing list