Redhat Linux User Administration


User ID = uid. The uid of root is 0.
UID from 1 to 499 is reserved for system services such as the user apache, nagios, etc

The first user created by root will always have a UID 500.

Maximum users = 60,000 by default. This could be increased.

When root is initially created /root will be created.
When user1 is created /home/user1 will be created.

/etc/login.dfs contains all the info about users.

By default when a user is created, a group will also be created for him. This will be his one and only primary group. He could be part of multiple secondary groups.

The file /etc/passwd stores user information but not the actual password

(username: presence of password: uid: gid: personal info: home dir: shell)

The ‘x’ in the password file indicates that password is present which might be in “shadow” concept or “umd 5” concept.

The file /etc/shadow is the one that holds the encrypted password.

The files /etc/passwd- and /etc/shadow- are backup files which usually gets updated within a certain interval of time.

# finger root : This will display user info of the user ‘root’.

# chfn root : To change the user info of the user root.

# useradd user_1 : To create a user names ‘user_1’. The default ‘uid’, ‘gid’, home directory and shell will be created.

# useradd -d /home/new user_2 : Add a new user with a specific home directory

# useradd -g g1 user_1 : Add a new user with primary group ‘g1’. The group ‘g1’ should be a existing one.

# useradd -G gg1 user_1 : Add a user with secondary group ‘gg1’.

# useradd -s /bin/ksh user_1 : Add a user and assign the default shell as /bin/ksh

# usermod -g group2 user_1 : Change the primary group of ‘user_1’

# usermod -l superuser root : Change the username of root to superuser

# usermod -d /new -m user_1 : Change the home directory of ‘user_1’ to /new and move all the files to the new directory.

# useradd -p shiju user_1 : Create a new user with ‘shiju’ as the password. This password will not be stored in the file in encrypted format.

# passwd -d user_1 : Disable the password for ‘user_1’. The user ‘user_1’ will not have any password nor will be able to create a password.

# passwd -l user_1 : Lock the account of ‘user_1’

# passwd -u user_1 : Unlock the account

# chage -l user_1 : List the aging information of password, account expiration details, etc.

# chage user_1 : Change the aging information of users’s password.

# userdel user_1 : Delete the user

# gpasswd -M user_1, user_2 g1 : Adding multiple users to group common

# gpasswd g1 : Assigning a password for the group g1. The reason for assigning password for a group is to prevent a user to change his default group and add to g1.

# grpuncov : This will copy the contents of group shadow password to /etc/group. Here the password in /etc/group will be encrypted.

# grpcon : This will bring back the shadow file and thus will remove the password displayed in /et c/group

# chown user1 /etc/myfile : Change the ownership of the file ‘myfile’

# chgrp mygroup /etc/myfile : Change the group ownership of the file ‘myfile’

# chown user4.group4 /etc/myfile : Change the user and group ownership of the file ‘/etc/myfile’.

# chown -R user5 mydir : Change the ownership of all the files and directories in the main directory ‘mydir’