[Samba] Fail to get domain SID and netbios name

Rowland penny rpenny at samba.org
Mon Jul 20 07:15:56 UTC 2020

On 19/07/2020 22:55, RhineDevil via samba wrote:
> `net getlocalsid` prints "Can't fetch domain SID for name: MYMACHINE"
> How could I solve?
> Is there a more parsable way for getting current machine domain SID and current machine NETBIOS name?

I thought your machine was domain joined, so why do you need the local 
machine SID ?

Having said that, 'net getlocalsid' should display the local SID and 
'net getdomainsid' should display the local and domain SID

If that doesn't work, try this:

wbinfo --own-domain

It should display your Netbios domain name, which you can use to get 
your domain SID:

wbinfo -D <YOURDOMAIN> | grep 'SID' | awk '{print $NF}'

Replace <YOURDOMAIN> with the output of the first command.

If you want the computers Netbios name, that's easy, as it is the 
computers short hostname in uppercase:

hostname -s | tr '[:lower:]' '[:upper:]'


More information about the samba mailing list