Pawan Sharma | May 21, 2012 | | Be the first to comment!

Understanding: /etc/passwd (User Account Management)

     In this post we will discuss one of the most important file in Redhat Enterprise Linux (RHEL), which is /etc/passwd. This file is very important because this serves as a default database of user on the system. Using /etc/passwd we can add users, modify user settings, etc from command line.
     For user administration part of the RHCSA Exam this is the most important file. Using /etc/passwd you can do the exam tasks and also check the results to confirm your completed tasks related to users.

An example entry of /etc/passwd is given below:

pawan:x:501:501:Pawan Sharma:/home/pawan:/bin/bash

Each entry in /etc/passwd file contains 7 fields.

1. Username: It is used when user log-in. It should be between 1 to 32 character.

2. Password: An 'x' character indicates that encrypted password is stored in /etc/shadow file. The 'x' refers and matches password value from /etc/shadow file. If we put * inplace of x then user can't login. If we keep second field blank then user can login without password.

3. User ID (UID): Each user must be assigned a User ID (UID). UID=0 is reserved for root user and UID 1 to 99 are reserved for other predefined accounts. It is a unique identity number for every user on the system.

4. Group ID (GID): Whenever a user is created a primary group is also created for a user. Every user have its own primary group but it can also have supplementary groups.

5. GECOS: This is optional and only used for informational purpose. Usually it contains the fill name of the user. You can say it as a comment field.

6. Home Directory: It represents  the absolute path to the user's home directory. If this directory does not exist the '/' directory becomes the users home directory.

7. Shell: The absolute path of command or shell (/bin/bash). Typically this field contain information about user's default shell.
This file is one of the most important file as far as RHCSA is concerned. So do a lot of experiments on this file, but before making any changes to this file take a backup of this file.

If you have any questions regarding user administration or /etc/passwd please ask me. I will try to answer.....

    No comments:

    Post a Comment