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
passwd

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
[username]:[x]:[UID]:[GID]:[COMMENT]:[HOMEDIRECTORY]:[Defaultshell]

# ubuntu entries
test1:x:1001:1001:,,,:/home/test1:/bin/bash
test2:x:1002:1002::/home/test2:/bin/sh

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

# sample ubuntu entries
test1:x:1001:
test2:x:1002:
  • For group management
groupadd
groupdel
usermod
  • 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.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube