Tuesday, July 10, 2007

format of /etc/passwd, /etc/shadow and /etc/group

Under linux, the user and group information are vitally kept with the below files

/etc/passwd
/etc/shadow
/etc/group

Typically, these files are automatically edited by issuing and adding a user using the useradd linux command like so

# useradd -d /home/username -c "User Name" -s /bin/false username

which creates standard columnar /etc/passwd content separated by semicolon like the below standard /etc/passwd linux format:

username:password:uid:gid:user_info:home_directory:shell_type

Explained:

username - the actual username account the person logs in with
password - showing x to indicate a password is set
uid - system number assigned to a user to indicate which files they own or have access to.
gid - group id number which is the group they belong to.
user_info - Information about user possibly fullname, office address, phone number and other
home_directory - the default directory that the user will own. Typically /home/username
shell_type - default shell setting is /bin/bash.

On the other hand, the /etc/shadow is not typically directly edited. Below is the /etc/shadow content format :

username:encrypted password:11843:0:99999:7:::

username - user account name
encrypted password - typically the encrypted password
#:#:#:#::: - Contains information about the number of days since the password was changed, when it expires or is disabled.

While /etc/group file format is

groupname:x:groupid:members1, members2

groupname - the groupname the username belongs to
password - An x indicates a password is set and if left blank no password has been set.
gid - the group id number which they belong to.
members - current members of the said group separated by a comma

Noticeably, the fields are separated by semicolon

You can view these files using your fave editor or a simple linux cat command will do

# cat /etc/passwd | grep username

Wazobi.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy