Thursday, April 30, 2009

Command to determine user id in Linux/Unix

User id is an unsigned integer used in the
operating system for a particular user.
The user id can be determined by executing
the id command as follows -
node1-1:~# id
uid=0(root) gid=0(root) groups=0(root)
It is interesting to note that root always has
the uid of 0. Use the -g switch to find out
which groups the current uid is a member of-
node1-1:~# id -g root
0
Another approach to determine the uid of a user
is by grepping through the /etc/passwd file. That
file has all information specific to a particular user.
Another nice thing to remember is that daemons
always operate with an uid of 1.

0 comments:

Post a Comment