3

If I want to get the SID of a particular user in windows. I would run the following cmd from a DOS windows:

cmd> wmic useraccount get name,sid
example output> kehelly S-1-5-21-3623811015-3361044348-30300820-1013

SID: Security Identifier.

When a user logs into a computer, their user SID and privileges are read. When this user requests access to a resource, the SID is checked and access is granted or denied depending on the SID.

I am trying to get similar info on a linux machine. Does anyone know how to do this?

4

2 Answers 2

4

There's not a one-to-one mapping between those concepts. Linux users have permissions bases on their userid, effective userid, what groups they are in, and the resource they are trying to access.

You can see these as @fedorqui notes using id username

Note that if you're using selinux there is also the concept of users, and roles, where an SELinux user isn't the same as a user id. Not every linux system is running SELinux. You can see additional roles by running just id and it'll spit out selinux permissions as well as uid and group.

You can use id -Z for just selinux:

$ id -Z
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
2

I know this is an old thread but in case someone else stumbles upon it like I did here is a way to find SID's from the console using rpcclient. First login to rpcclient:

rpcclient -U "fred" 192.168.0.187 (replace user name and server IP accordingly)

Once logged in run this to find a users SID:

rpcclient $> lookupnames joe                                                    
joe S-1-5-21-2893105422-2373464063-1795470530-1000 (User: 1)

Hopefully someone else finds this useful. It took quite a bit of googling to find it. This info may be handy for troubleshooting Samba and ACL's.

1
  • Great solution, thanks. Also, you can use -W option for rpcclient to specify the domain. Also try lookupsids for the reverse.
    – cmevoli
    Jan 12, 2018 at 14:32

You must log in to answer this question.