Linux Bootcamp Series – User Management

Exercise

  • Use groupadd command to create 3 groups
    • dev
    • test
    • admin
groupadd dev
groupadd test
groupadd admin
  • Create 3 users
    • usr1 in Group dev with password and home directory
    useradd -g dev -d /home/usr1 -p password usr1
    
    • usr2 in Group test with password and home directory
    useradd -g test -d /home/usr2 -p password usr2
    
    • usr3 in Group admin with password and home directory
    useradd -g admin -d /home/usr3 -p password usr3
    
    • usr4 in Groups dev and test with password and home directory
    useradd -G dev,test -d /home/usr4 -p password usr4
    
  • To check the user groups
su <username>
groups
  • To add user to existing groups
man usermod

usermod -aG <group-name> <user-name>
  • Try deleting the users using userdel and groups using groupdel

ROOT User and sudo

  • Root user is super user and has access to every thing on a linux machine.
  • For the non root users to perform administrative actions on linux machines, there is a file in /etc/sudoers
    • On Ubuntu Machine to give existing user permissions to sudo, add user to sudo group
    • On Redhat family (Centos, RHEL, Fedora, Amazon Linux) Machine to give existing user permissions to sudo, add user to wheel group

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner