Linux Classroom Series – 24/Jul/2020

Users and Groups in Linux

  • Linux is a multi user operating system.
  • To add a new user account, we have two commands
    • adduser
    • useradd
  • Generally whenever a user is created, User gets
    • username
    • uid
    • home directory
    • A group is created for the user with the same name as username
  • Difference between useradd and adduser
adduser test1
useradd test2
cat /etc/passwd
ls /home

Preview Preview Preview

  • Lets look at redhat Preview Preview Preview
  • we can set the password to the user by executing

Preview Preview

  • In the home directory, few hidden files are created Preview Preview
  • If you look into /etc/passwd the entry pattern in this file looks as

# ubuntu entries

  • If you look into /etc/group file, the format for each line
[Group name]:[Group password]:[Gid]:[Group members]

# sample ubuntu entries
  • For group management
  • Exercise:

    1. Create a user called as ironman
    2. Create a user called as thor
    3. Create a user called as hulk
    4. create a user called as superman
    5. Create a user called as batman
    6. Create a user called as wonderwoman
    7. create a group called as Avengers and add ironman, thor and hulk to it
    8. Create a group called as JusticeLeague and add superman, batman and wonderwoman.
    9. Some screenshots Preview Preview
  • How can i give sudo permissions to my users

    • In ubunutu we have a group called sudo, if you add users to this sudo group, then can execute sudo commands. Preview
    • In RHEL family, we have a group called as wheel, adding users to this wheel group can enable users to execute sudo commands Preview
  • Adding a user ironman to sudo group Preview

Leave a Reply

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

About learningthoughtsadmin