Ads 468x60px

Monday, July 23, 2012

Linux: User/Group Management Commands

This lab will help you to learn commands for user and group management

•   See the /etc/passwd and /etc/shadow files
Ans. $cat /etc/passwd
        $cat /etc/shadow

•   Make a new user “tux” with default home directory and password “pakistan”
Ans. $adduser tux
        Enter new UNIX password: pakistan

•   See the changes in /etc/passwd and /etc/shadow
Ans. $cat /etc/passwd
        $cat /etc/shadow

•   Create a group “BIT10” with group ID 99 and change tux’s group to “BIT10”
Ans. $groupadd -g 99 BIT10
        $usermod -a -G BIT10 tux

•   Move the user’s current home directory to the new directory “/studentHome”
Ans. $usermod -d /studentHome 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
Ans. $passwd
        $passwd -l tux

        $passwd -n 2 tux
        $passwd -i 5 tux
        $chage tux (It is used to manually enter the values for (minimum,inactive))
        To view information
        $chage -l tux

•   See the changes in /etc/passwd and /etc/shadow and /etc/group files
Ans. $cat /etc/passwd
        $cat /etc/shadow

•   Delete the group “BIT10” and delete the account of “tux”
Ans. $userdel tux
        $groupdel BIT10

No comments:

Post a Comment