[Samba] Lookup sid with libsmbclient (invoked from c# on mono)
aaptel at suse.com
Mon Oct 12 15:25:03 UTC 2020
Rowland penny via samba <samba at lists.samba.org> writes:
> I have no idea just what you are hoping to achieve, but it is seemingly
> possible without authentication as 'wbinfo -n ACCOUNT_NAME' returns the
> accounts SID. So try looking at the wbinfo code.
wbinfo is talking to winbind which itself is talking to the AD. In this
scenario the client previously joined (authenticated).
What Vincent is after I think is a simple standalone way to query
sid/names for his app to use that doesn't require seting up whole domain
member. The rpcclient cli tool can do it.
You can call the cli tool from your app (.110 is my AD ip, you can use
$ rpcclient -U administrator%mypassword -c 'lookupnames user1' //192.168.2.110
user1 S-1-5-21-596735176-1287999152-3436313279-1104 (User: 1)
$ rpcclient -U administrator%mypassword -c 'lookupsids S-1-5-21-596735176-1287999152-3436313279-1104' //192.168.2.110
S-1-5-21-596735176-1287999152-3436313279-1104 NUC\user1 (1)
...Or copy the code (note that it is GPL though):
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
More information about the samba