You are on page 1of 1

A Linux System administrator must have proficient user administration skills.

So me of the basic commands provided by RHEL6 for this purpose are useradd, passwd, userdel, usermod, groupadd, groupmod, groupdel, etc. Apart from using these com mands, we do have another way of managing the users by modifying the files that contain all user information. In this post we will be talking about two main fil es present in the /etc/ folder namely passwd and shadow. Fields in /etc/passwd Username:Password:UID:GID:Comment:HomeDirectory:Shell Username - Specifies the username of the user Password - An x in this field specifies that the password is present in shadow f ile UID - A unique user id for the user GID - Group id of the user Comment - Additional details about the user Home Directory - path to the home directory of the user Shell - The default command shell of the user Fields in /etc/shadow Username:Password:lastchanged:Maximum:Minimum:Warn:Inactive:Expire Username - Specifies the username of the user Password - This field contains the encrypted password Lastchanged - Days since Jan 1, 1970 when the password was last changed Minimum - Specifies the minimum number of days required between password changes Maximum - Specifies the maximum number of days the password is valid Warn - The number of days before which the user must be warnedd to change the pa ssword before it expires Inactive - Number of days since the account is inactive Expire - Days since Jan 1, 1970 the account is disabled Adding a new user Open the passwd file in a text editor, go to the last line of the file and press enter to insert a new line. Now in this new line weite the details about the us er. For example, ankit:x:505:505:Ankit Sharma:/home/ankit:/bin/bash Save the file and exit. Now open the shadow file and in this file insert a new line at end. Insert the r equired details in this line as per the field format of the file. For example, ankit:Ep6mckrOLChF.:10063:0:99999:7::: Save the file and exit. Still our work is not complete. Go to the /home/ directory and create a new dire ctory with the same name as specified in the passwd fle for the user. cd /home/ mkdir ankit Now set the desired permissions for this directory. chmod 750 ankit Now go to /var/spool/mail directory and create a new file with the username. cd /var/spool/mail touch ankit That's it. You have created a new user without using the useradd command!!! Deleting a user In order to delete a user simply delete the lline containg the user information from the passwd file. Optionally, u may also delete it from the shadow file. In case you dont need the files created by the user you may also delete the user's home directory and his mail file.

You might also like