SlideShare a Scribd company logo
Manage Local Users and Groups
Manage Local Users and Groups - RHCSA (RH124)
Root User System User Regular User
Purpose Full Administrative access
Run specific system
services/processes
General user activities
UID Range 0 1 to 999 1000 and above
Home Dir /root
Typically none or service
specific
/home/username
Login Shell /bin/bash or other
Usually /usr/sbin/nologin or
/bin/false
/bin/bash or other login
shells
Permissions
Unlimited, Full system
access
Limited to specific services
Limited to user specific
actions
Creation &
Management
Default user created
during installation and
managed by system admin
Created and managed by
system or package
installation scripts
Created and managed by
system admin for general
use
Example root ‘Chrony’, ‘systemd-oom’ ‘User1’ , ‘coder’
○ Managing Users (Creating, modifying, and deleting)
○ Managing passwords
○ Group memberships
○ Setting file/directories permissions
○ Granting Elevated privileges
○ User Login
User Account Management
lists all known users on the system with detailed information
● Command: lslogins
Machine Name (Hostname)
List all Users
-s option is used with lslogins to display system accounts(UID < 1000 by default).
● Command: lslogins-s
Machine Name (Hostname)
List System Users
Machine Name (Hostname)
-u option is used with lslogins to list all user accounts including root
(UID >= 1000 by default).
● Command: lslogins-u
List Root & Regular Users
To display the username of the current user
● Command: whoami
Add a new User (or Regular User account)
● Command: useradd-c ‘<user_info’ <user_name> OR
adduser <user_name> [works in Debian based dist.]
Machine Name (Hostname)
Managing Users
Checking Current Users
● Command: cat /etc/passwd
/etc/passwd : User account info file
Note : "x" placeholder denotes that the encrypted password is stored in the
/etc/shadow file for security.
Display user and their group information
● Command: id <user_name>
Modify user account properties (-s is to change the user's login shell)
● Command: usermod-s <new_shell> <user_name>
Machine Name (Hostname)
Use-d with usermod command to change the user's home directory
● Command: usermod-d <new_dir> <user_name>
Add a user to a secondary group (-aG is used to append a user
to additional groups without removing them from their existing
groups)
● Command: usermod-aG <group_name> <user_name>
Delete user(-r is used for deleting user along with its home
directory and mail spool)
● Command: userdel-r <user_name>
Add user with all parameters set
● Command: useradd-g testers-s /bin/bash-c 'John Doe'-m
-d /home/john john
● -g testers: Assigns the user to the "testers" group.
● -s /bin/bash: Sets the default shell to Bash.
● -c 'John Doe': Adds a comment (full name) for the user.
● -m: Creates a home directory for the user.
● -d /home/john: Specifies the home directory.
● john: Username of the new user.
Set or change user password
● Command: passwd <user_name>
OR
● Command : echo ‘<user_name>:<password>’ | chpasswd
Managing Password
● Checking Users password
○ Command: cat /etc/shadow
● Placeholder '!' for No Password
● Stores hashed passwords with salt
● Salt adds randomness to hashed
passwords
After setting password
Manage Local Users and Groups - RHCSA (RH124)
List or change user password expiry information (-l to list the info)
● Command: chage [options] <user_name>
Machine Name (Hostname)
● Users Sharing Common Permissions
User Groups
lists all groups on the system
● Command: getent group
Machine Name (Hostname)
List all groups
● Primary Group: For ‘student’ and ‘user1’ primary
groups are there with same name
● Secondary Group: ‘student_group’ is another
group which has two users ‘student’ and ‘user1’
Create a new group
● Command: groupadd <group_name>
Verify group creation by retrieving group information
● Command: getent group <group_name>
Machine Name (Hostname)
Modify group properties (add user1,student using-U in student_group)
● Command: groupmod [options] <group_name>
Verify by getent group command whether users added or not
● Command: getent group <group_name>
Machine Name (Hostname)
● /etc/group file : Stores group information like group names and IDs
Delete a group & verify by getent group command
● Command: groupdel <group_name>
Machine Name (Hostname)
● Access controls:
○ Who can access a file or directory.
○ What actions they can perform on them.
File/Directory Permission
Change group ownership of files
● Command: chgrp <user_name>
Machine Name (Hostname)
● Authorizing users to perform administrative tasks or run all
commands
Granting Elevated privileges
Verify whether user have sudo access or not
● Command: sudo-l-U <user_name>
● Sudoers file in Linux specifies who can run commands with
elevated privileges.
● Edit sudoers file using vi editor
○ Command: vi /etc/sudoers
● Find this section
● Add your user in same format and save the file
● student : Specifies the user granted sudo privileges
● ALL: Allows sudo on any host
● ALL : Permits running commands as any user
● ALL: Authorizes execution of any command.
● Verify whether user got sudo access or not
● /etc/login.defs : used for configuring global user
authentication settings, such as password aging, login
restrictions, and default user environment settings.
User Login
Manage Local Users and Groups - RHCSA (RH124)
User Login
Switch user
● Command : su-<user_name>
● /var/log/secure: Logs authentication-related events, including
login attempts and authentication activities.
● All login , logout and authentication failures events are logged.
Logs
Manage Local Users and Groups - RHCSA (RH124)

More Related Content

PDF
Control Access to Files - RHCSA (RH124).pdf
PDF
Configure and Secure SSH - RHCSA (RH124).pdf
PDF
Access Linux File System in RHEL - RHCSA (RH124).pdf
PPTX
User management
PPTX
Users and groups
PPTX
Basics of-linux
PPTX
Evolution of GIT - Linus Torvald's magic
PDF
Course 102: Lecture 14: Users and Permissions
Control Access to Files - RHCSA (RH124).pdf
Configure and Secure SSH - RHCSA (RH124).pdf
Access Linux File System in RHEL - RHCSA (RH124).pdf
User management
Users and groups
Basics of-linux
Evolution of GIT - Linus Torvald's magic
Course 102: Lecture 14: Users and Permissions

What's hot (20)

PPTX
Linux Basic commands and VI Editor
PDF
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
PPTX
File permissions
PPT
Linux Crash Dump Capture and Analysis
PDF
Lesson 2 Understanding Linux File System
PPTX
Linux standard file system
PPTX
Resource Monitoring and management
PDF
Course 102: Lecture 9: Input Output Internals
PPTX
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
PPTX
Fuse- Filesystem in User space
PDF
Basic linux commands for bioinformatics
PDF
Systemd: the modern Linux init system you will learn to love
PDF
Crontab
PPTX
Dc domain controller
PPTX
Linux basics part 1
PPTX
Linux basic commands
PPTX
Basic commands of linux
PDF
Linux Basic Commands
PPTX
Linux And perl
PDF
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
Linux Basic commands and VI Editor
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
File permissions
Linux Crash Dump Capture and Analysis
Lesson 2 Understanding Linux File System
Linux standard file system
Resource Monitoring and management
Course 102: Lecture 9: Input Output Internals
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
Fuse- Filesystem in User space
Basic linux commands for bioinformatics
Systemd: the modern Linux init system you will learn to love
Crontab
Dc domain controller
Linux basics part 1
Linux basic commands
Basic commands of linux
Linux Basic Commands
Linux And perl
Sa1 chapter-5-managing-local-linux-users-and-groups-v2 (4)
Ad

Similar to Manage Local Users and Groups - RHCSA (RH124) (20)

PDF
Users and groups in Linux
PPT
Unix Administration 3
PPT
Learning Linux v2.1
PDF
Linux Fundamentals and how to use linux.pdf
PPTX
Introduction to Linux
PPT
06 users groups_and_permissions
PPTX
User and groups administrator
PDF
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
PDF
4_Users_and_File_Permission_and_Directory_Commands
PDF
Familiarisation of for permission for authentication.pdf
PDF
User Management Command Cheat Sheet.pdf
PPT
PPTX
Linux Fundamentals - An Intro to Linux Fundamentals
PPT
Linux lecture
DOC
Most frequently used unix commands for database administrator
ODP
CS50x Permissions, Files, Users
ODP
System Administeration Basics
PPT
Basic linux day 5
PPSX
User Administration in Linux
PPTX
World Domination Through Helix Broker
Users and groups in Linux
Unix Administration 3
Learning Linux v2.1
Linux Fundamentals and how to use linux.pdf
Introduction to Linux
06 users groups_and_permissions
User and groups administrator
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
4_Users_and_File_Permission_and_Directory_Commands
Familiarisation of for permission for authentication.pdf
User Management Command Cheat Sheet.pdf
Linux Fundamentals - An Intro to Linux Fundamentals
Linux lecture
Most frequently used unix commands for database administrator
CS50x Permissions, Files, Users
System Administeration Basics
Basic linux day 5
User Administration in Linux
World Domination Through Helix Broker
Ad

More from RHCSA Guru (20)

PDF
How to Set Up a RHEL 9 Virtual Lab for RHCSA Practice.pdf
PDF
CompTIA Linux (Plus) Exam Overview .pdf
PDF
Linux Professional Institute LPIC-1 Exam.pdf
PDF
LVM Management & Disaster Recovery - RHCSA+.pdf
PDF
Managing Multiple Logical Volumes - RHCSA+.pdf
PDF
Master Logical Volume Management - RHCSA+.pdf
PDF
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
PDF
Ansible Variables in Playbook - RHCE.pdf
PDF
Comprehensive Guide to Ansible Application Roles.pdf
PDF
Using Tags in Ansible Playbooks RHCE.pdf
PDF
Comprehensive Guide to Ansible Roles - RHCE
PDF
Mastering Handlers, Conditions, and Loops in Ansible Playbooks - RHCE.pdf
PDF
Essential Ad-hoc Commands in Ansible - RHCE.pdf
PDF
RHEL in Shell Scripting Advanced - RHCSA+.pdf
PDF
Shell Scripting Intermediate - RHCSA+.pdf
PDF
Introduction to Shell Scripting - RHCSA+.pdf
PDF
Command Line Text Processing - RHCSA +.pdf
PDF
Mounting and Creating Links - RHCSA (RH124) .pdf
PDF
Basic Command Line Tools - RHCSA (RH124).pdf
PDF
Podman Networking Essentials - RHCSA+.pdf
How to Set Up a RHEL 9 Virtual Lab for RHCSA Practice.pdf
CompTIA Linux (Plus) Exam Overview .pdf
Linux Professional Institute LPIC-1 Exam.pdf
LVM Management & Disaster Recovery - RHCSA+.pdf
Managing Multiple Logical Volumes - RHCSA+.pdf
Master Logical Volume Management - RHCSA+.pdf
Ansible Vault Encrypting and Protecting Secrets - RHCE.pdf
Ansible Variables in Playbook - RHCE.pdf
Comprehensive Guide to Ansible Application Roles.pdf
Using Tags in Ansible Playbooks RHCE.pdf
Comprehensive Guide to Ansible Roles - RHCE
Mastering Handlers, Conditions, and Loops in Ansible Playbooks - RHCE.pdf
Essential Ad-hoc Commands in Ansible - RHCE.pdf
RHEL in Shell Scripting Advanced - RHCSA+.pdf
Shell Scripting Intermediate - RHCSA+.pdf
Introduction to Shell Scripting - RHCSA+.pdf
Command Line Text Processing - RHCSA +.pdf
Mounting and Creating Links - RHCSA (RH124) .pdf
Basic Command Line Tools - RHCSA (RH124).pdf
Podman Networking Essentials - RHCSA+.pdf

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
A Presentation on Artificial Intelligence
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Building Integrated photovoltaic BIPV_UPV.pdf
Electronic commerce courselecture one. Pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The Rise and Fall of 3GPP – Time for a Sabbatical?
A Presentation on Artificial Intelligence
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding

Manage Local Users and Groups - RHCSA (RH124)

  • 1. Manage Local Users and Groups
  • 3. Root User System User Regular User Purpose Full Administrative access Run specific system services/processes General user activities UID Range 0 1 to 999 1000 and above Home Dir /root Typically none or service specific /home/username Login Shell /bin/bash or other Usually /usr/sbin/nologin or /bin/false /bin/bash or other login shells Permissions Unlimited, Full system access Limited to specific services Limited to user specific actions Creation & Management Default user created during installation and managed by system admin Created and managed by system or package installation scripts Created and managed by system admin for general use Example root ‘Chrony’, ‘systemd-oom’ ‘User1’ , ‘coder’
  • 4. ○ Managing Users (Creating, modifying, and deleting) ○ Managing passwords ○ Group memberships ○ Setting file/directories permissions ○ Granting Elevated privileges ○ User Login User Account Management
  • 5. lists all known users on the system with detailed information ● Command: lslogins Machine Name (Hostname) List all Users
  • 6. -s option is used with lslogins to display system accounts(UID < 1000 by default). ● Command: lslogins-s Machine Name (Hostname) List System Users
  • 7. Machine Name (Hostname) -u option is used with lslogins to list all user accounts including root (UID >= 1000 by default). ● Command: lslogins-u List Root & Regular Users
  • 8. To display the username of the current user ● Command: whoami Add a new User (or Regular User account) ● Command: useradd-c ‘<user_info’ <user_name> OR adduser <user_name> [works in Debian based dist.] Machine Name (Hostname) Managing Users
  • 9. Checking Current Users ● Command: cat /etc/passwd
  • 10. /etc/passwd : User account info file Note : "x" placeholder denotes that the encrypted password is stored in the /etc/shadow file for security.
  • 11. Display user and their group information ● Command: id <user_name>
  • 12. Modify user account properties (-s is to change the user's login shell) ● Command: usermod-s <new_shell> <user_name> Machine Name (Hostname)
  • 13. Use-d with usermod command to change the user's home directory ● Command: usermod-d <new_dir> <user_name>
  • 14. Add a user to a secondary group (-aG is used to append a user to additional groups without removing them from their existing groups) ● Command: usermod-aG <group_name> <user_name>
  • 15. Delete user(-r is used for deleting user along with its home directory and mail spool) ● Command: userdel-r <user_name>
  • 16. Add user with all parameters set ● Command: useradd-g testers-s /bin/bash-c 'John Doe'-m -d /home/john john ● -g testers: Assigns the user to the "testers" group. ● -s /bin/bash: Sets the default shell to Bash. ● -c 'John Doe': Adds a comment (full name) for the user. ● -m: Creates a home directory for the user. ● -d /home/john: Specifies the home directory. ● john: Username of the new user.
  • 17. Set or change user password ● Command: passwd <user_name> OR ● Command : echo ‘<user_name>:<password>’ | chpasswd Managing Password
  • 18. ● Checking Users password ○ Command: cat /etc/shadow ● Placeholder '!' for No Password ● Stores hashed passwords with salt ● Salt adds randomness to hashed passwords
  • 21. List or change user password expiry information (-l to list the info) ● Command: chage [options] <user_name> Machine Name (Hostname)
  • 22. ● Users Sharing Common Permissions User Groups
  • 23. lists all groups on the system ● Command: getent group Machine Name (Hostname) List all groups
  • 24. ● Primary Group: For ‘student’ and ‘user1’ primary groups are there with same name ● Secondary Group: ‘student_group’ is another group which has two users ‘student’ and ‘user1’
  • 25. Create a new group ● Command: groupadd <group_name> Verify group creation by retrieving group information ● Command: getent group <group_name> Machine Name (Hostname)
  • 26. Modify group properties (add user1,student using-U in student_group) ● Command: groupmod [options] <group_name> Verify by getent group command whether users added or not ● Command: getent group <group_name> Machine Name (Hostname)
  • 27. ● /etc/group file : Stores group information like group names and IDs
  • 28. Delete a group & verify by getent group command ● Command: groupdel <group_name> Machine Name (Hostname)
  • 29. ● Access controls: ○ Who can access a file or directory. ○ What actions they can perform on them. File/Directory Permission
  • 30. Change group ownership of files ● Command: chgrp <user_name> Machine Name (Hostname)
  • 31. ● Authorizing users to perform administrative tasks or run all commands Granting Elevated privileges Verify whether user have sudo access or not ● Command: sudo-l-U <user_name>
  • 32. ● Sudoers file in Linux specifies who can run commands with elevated privileges. ● Edit sudoers file using vi editor ○ Command: vi /etc/sudoers
  • 33. ● Find this section ● Add your user in same format and save the file
  • 34. ● student : Specifies the user granted sudo privileges ● ALL: Allows sudo on any host ● ALL : Permits running commands as any user ● ALL: Authorizes execution of any command.
  • 35. ● Verify whether user got sudo access or not
  • 36. ● /etc/login.defs : used for configuring global user authentication settings, such as password aging, login restrictions, and default user environment settings. User Login
  • 38. User Login Switch user ● Command : su-<user_name>
  • 39. ● /var/log/secure: Logs authentication-related events, including login attempts and authentication activities. ● All login , logout and authentication failures events are logged. Logs