Wednesday 11 January 2012

User & Group Management in Linux


User and Group Management
·        See the /etc/passwd and /etc/shadow files
These files contain the information about the user login and password and other variables.
·        Make a new user “tux” with default home directory and password “pakistan
sudo useradd -p pakistan tux
·        See the changes in /etc/passwd and /etc/shadow
Both of the files contain last row as tux user.
tux:x:1001:1002::/home/tux:/bin/sh
tux:pakistan:15249:0:99999:7:::
·        Create a group “BIT10” with group ID 99 and change tux’s group to “BIT10"
sudo groupadd -gid 99 BIT10A
sudo gpasswd -a tux BIT10A;    sudo usermod -g BIT10A tux
·        Move the user’s current home directory to the new directory “/studentHome”
sudo usermod -d /sohaibHome tux

·        Change this user’s password to “d!g!t@l” with following settings:-
Lock the account if it has been inactive for 5 days
Minimum 2 days must be past before the user can change hi/her/its password
sudo usermod -p 'd!g!@|' –f 5 tux;
chage –i 5 –m 2 tux;
·        See the changes in /etc/passwd and /etc/shadow and /etc/group files
Both show changes for tux
·        Delete the group “BIT10” and delete the account of “tux”
groupdel BIT10A

0 comments:

Post a Comment

 
Free Host | lasik surgery new york