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

User Administration and /etc/gshadow

In Redhat Enterprise Linux /etc/gshadow is one of the file is rarely heard by users even system administrators. To learn Linux we have to know all command line tools and important files. In this post we will discuss about /etc/gshadow file.

/etc/gshadow is the goup shadow file and contains the following four fields-:

1. Group Name

2. Contains the encrypted group password of the text password which was specified using gpasswd command

    If the file /etc/gshadow is deleted , then this encryped password is moved to second field of /etc/group.

    If no password is given to group, then a '!' is displayed in the file.

3. Contains list of the group administrators names.By default it is blank i.e. only user having same name as,group name is first group administrator.

4. Contains list of group members names.Blank by default.


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

Understanding /etc/group

In this post we will discuss about an important file /etc/group. To pass Redhat Certified System Administration(RHCSA) exam we need to know all important files related to user administration. In /etc/group file we can find group related all user groups in Linux operating system. 

When a user is added , a user private group is created and the corresponding entry is put in /etc/group. /etc/group contains 4 fields and are
explained below

1. GROUP NAME: which is the same as USER_NAME which is specified with the useradd command.

2. GROUP PASSWORD: Group Password can be given using the command gpasswd .

   For eg:     gpasswd pawan
                   Changing the password for group pawan
                   New Password:
                   Re-enter new password:

3. GID -> Group ID which is the same as UID.

4. The last field discribe ther members of the group except the user which is already a member of the group .

   A user is added to a group using the follwing command -:

   usermod -G GROUP_NAME USER_NAME

   For eg:  usermod -G pawan major_group

   A Group can also be created using the command groupadd

   For eg:  groupadd major_group

   An entry for the "major_group" group will be placed in the file /etc/group.

If we want to give same permissions to few users, we can make them member of a group. By making some users member of a group we can give permission to that group and all users in that group will get that permission. We can also set Access Control Lists (ACL) on group.

Pawan Sharma | | | Be the first to comment!

Understanding: /etc/shadow (User Account Management)

RHCSA exam focus on basic system administration, and questions asked in RHCSA are similar situations which you will face in real environment.
 /etc/shadow is not commonly used file, but is very important as far as User Administration and RHCSA is concern.
 /etc/shadow contains password related information for user and groups on the system. This file stores actual password in encrypted format for user's account with additional properties related to user password. Only root user can read shadow file, other users can not read this file.

There are 9 fields in /etc/shadow file seperated by ':' i.e. IFS (Internal Field Seperator) ,and they are explaeind as below -:An example entry of /etc/shadow is given below:

pawan:$1$J6/rsxw3$TEcDpPsW0gx9035DFNlUU/:15162:0:99999:7:::
                                                                                       
Each entry in /etc/shadow contains 9 fields which are separated by ":".
/etc/shadow
1. Username: It is used when user log-in. It should be between 1 to 32 character.

2. Password: It is a user's encrypted password. The password should be minimum of 6 to 8 characters long including special characters/digits.
3. Days since Unix epoch password was changed (Jan 1 1970). This can also be interpreted as the field , if chaged to 0 , the user password is immdeatly expired . When the user logs in the next time , he is forced to change his pasword ( root enforced ).

4. Minimum: Days left before password may be changed. This can also be interpreted as number of days after which the password is allowed to be changed.This is to stop user from changing his password very frequently . Normally is given 0 , so that user can change his password the number of times he desires.

5. Maximum: days after which password must be changed. This field is used to put the restriction on the maximum no. of days that a password can be used by the user.After the no. specified in the file against this file expires , he/she is forced to change their password.

6. Warn: The days before password is to expire, that user is warned that his/her password must be changed.

7. Inactive(Password Grace Field): The days after password expires, that account is disabled. This field is used as warning period alloted to user after his account's password is expired as specified by the 5th and 6th field. After this period the user's account is disabled and can only be re-enabled by the root user.
8. This field is used as an emergency disable field by the root user. If 0 is given in this field , the user account will be disabled immediately and he cannot login till the time root does not remove this restriction.
 
9. This field is reserved for future use.
5th , 6th and 7th field combined together can be used by the root to make a policy to make sure that passowrd is changed after a specified no of days , keeping in account grace and warning field. If the user is not able to comply for any perticular reason,his account is blocked.

Using this file you can manage password properties.
Please click on facebook like button if you like the post.

    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.....

      Pawan Sharma | | | Be the first to comment!

      User Administration in Linux

      User administration is the most important part of Linux system administration. It is one of the most important objective of RHCSA and RHCE certification exam. In Linux Users and Groups can be administered using user/group administration GUI tool, also users can be created through command line as well in Redhat Enterprise Linux. But I will suggest you to use command line user administration commands as much as possible because in production environment GUI won’t be provided. Many people who are learning Linux don’t know all features of user administration commands and related files. In the next few posts we will discuss all about the user administration and features.

      There are three types of users in Linux.

      1. Superuser: At the time of Linux installation it is create. Root user has right to make other users & his “userid” & “groupid” is zero in “/etc/passwd” file.
      2. Systemuser: These users create by System. They can't login because their shell ‘sbin/noloin’ is default in seventh field in `/etc/passwd' file.
      3. Normaluser: These users create by superuser.

      To add a user from command line we need to use a command useradd/adduser:
      user and group in Red hat enterprice linuxFor example “useradd pawan”.

      adduser is not a binary but it is a symlink to the old unix command useradd which is present in /usr/sbin directory and this command can only be executed by root. In total, 69 things happen when a command useradd is given, we will discuss all.

      When useradd command executed, the information of useradd store in two main configuration files ‘passwd’ & ‘group’ these are related with other configuration files.

      Configuration files

      |----/etc/passwd
      |
      |----/etc/group
      |
      |----/etc/shadow
      |
      |----/etc/gshadow
      |
      |----/etc/login.defs
      |
      |----/etc/default/useradd
      |
      |----/etc/skel

      We will discuss about all these files in details in next post.