SlideShare a Scribd company logo
1 of 15
Download to read offline
How To Manage Linux User on RHEL 7
i | P a g e
Table of Contents
Overview.......................................................................................................................................................1
Applies To......................................................................................................................................................1
User Management – Insight..........................................................................................................................1
User Type and Purpose.............................................................................................................................1
User ID and Group ID Range .....................................................................................................................1
User Login Shell.........................................................................................................................................2
User Add Options......................................................................................................................................2
User Management – USERADD.....................................................................................................................3
Create User – No Options .........................................................................................................................3
Create User – Set User ID..........................................................................................................................3
Create User – Set Group ID.......................................................................................................................4
Create User – Set Home Directory............................................................................................................4
Create User – Comment............................................................................................................................5
Create User – Login Shell ..........................................................................................................................5
Create User – Duplicate User ID ...............................................................................................................6
Create User – Account Expiry Date...........................................................................................................6
Create User – No Home Directory ............................................................................................................7
Create User – No Shell ..............................................................................................................................7
User Management – USERMOD....................................................................................................................8
Modify User – User ID...............................................................................................................................8
Modify User – Primary Group ID...............................................................................................................8
Modify User – Append Groups .................................................................................................................9
Modify User – Move Home Directory.......................................................................................................9
Modify User – Comment.........................................................................................................................10
Modify User – Login Name......................................................................................................................10
Modify User – Login Shell .......................................................................................................................11
Modify User – Lock User.........................................................................................................................11
Modify User – Unlock User .....................................................................................................................12
User Management – USERDEL....................................................................................................................12
How To Manage Linux User on RHEL 7
ii | P a g e
Delete User – Username.........................................................................................................................12
Delete User – Home Directory................................................................................................................13
Delete User – Force Removal..................................................................................................................13
How To Manage Linux User on RHEL 7
1 | P a g e
Overview
The purpose of this guide is to help us in creating, remove or modify a user account on Linux server. In
this guide we will focus on user add, removal and modifying.
Applies To
 Tested on CentOS 7 and RHEL 7
User Management – Insight
In Linux users are managed by useradd, userdel and usermod commands.
There are 3 types of users namely, Super User Account, System User Account, Normal Account
User Type and Purpose
User Type is defined and determined by User ID assigned to the user. Ideally only one super user should
be created.
User User Type User ID Group ID Information
root Super 0 0 Also called root user
apache System 1 1 Apache webserver owner and service account
test.user Normal 500 500 Normal User Account
User ID and Group ID Range
User ID Range and Group ID Range is assigned is determined based on setting in the file “/etc/login.defs”.
User Type UID Range GID Range Information
Super 0 0 root user is always created with UID & GID 0
System 1 to 499 1 to 499 System account can be created within the range
Normal 500 to 60000 500 to 60000 Normal account can be created within the range
Note: Choosing the above UID & GID is advisable because of easier identification of user account type.
cat /etc/login.defs | grep -e 'UID|GID'
How To Manage Linux User on RHEL 7
2 | P a g e
User Login Shell
User’s Login shell can be assigned to a user as per the list in the file “/etc/shells”. This list is also supported
shells on the servers.
User Add Options
In this section we will create user with few different options. In order to create a user you need provide
mandatory “username” and all other attributes are optional.
Option Purpose
-u User Account’s User ID (number)
-g User Account’s Group ID (number)
-d Create Home Directory in path
-c Comments for the user, typically User’s Full Name or profile
-s User’s Login shell
-o Create User with Existing user ID (duplicate)
Defaults are determined based on the setting in the file “/etc/default/useradd” or execute command
useradd -D.
How To Manage Linux User on RHEL 7
3 | P a g e
User Management – USERADD
In this section we will create users with different options, to create a user execute the command
“useradd” as per the business need pass the optional parameters.
Create User – No Options
To create user account, run the command; once you create the account, user’s login password has to be
set with the command “passwd” as shown below;
useradd test.user1
passwd test.user1
To know the User’s User ID run the command below;
cat /etc/passwd | grep | test.user1 | awk -F":" '{ print "User " $1,"UID is "$3}'
Create User – Set User ID
To create a user account with a specific User ID, run the command;
useradd -u 1500 test.user2
passwd test.user2
How To Manage Linux User on RHEL 7
4 | P a g e
Create User – Set Group ID
To create a user account and assign to a specific Group ID, run the command, this group should already
exists.
useradd -g 100 test.user3
passwd test.user3
Create User – Set Home Directory
To create a user account with a non-default home directory, run the command;
useradd -d /home/appln.user test.user4
passwd test.user4
How To Manage Linux User on RHEL 7
5 | P a g e
Create User – Comment
To create a user account with a comment, run the command;
useradd -c "Test User #5" test.user5
passwd test.user5
Create User – Login Shell
To create a user account with a non-default shell (bash), run the command;
useradd -s /bin/sh test.user6
passwd test.user6
How To Manage Linux User on RHEL 7
6 | P a g e
Create User – Duplicate User ID
To create a user account with non-unique user ID, run the command;
useradd -ou 1500 test.user7
passwd test.user7
Create User – Account Expiry Date
To create a user account with account expiry, run the command; Typically these accounts are created for
a temporary time period.
By default when you create a user without option “-e” user account is expiry date is set to “0”, which
means account never expires.
useradd -u 100 -e 2016-08-31 test.user8
passwd test.user8
chage -l test.user8
How To Manage Linux User on RHEL 7
7 | P a g e
Create User – No Home Directory
To create a user account without home directory, run the command;
useradd -g 100 -M test.user9
passwd test.user9
ls -l /home/test.user9
Create User – No Shell
To create a user account without shell (user is restricted to login), run the command;
useradd -g 100 -s /sbin/nologin test.user10
cat /etc/passwd | grep -E "test.user10| nologin"
How To Manage Linux User on RHEL 7
8 | P a g e
User Management – USERMOD
In this section we will modify user account with different options, to modify a user execute the command
“usermod” as per the business need pass the optional parameters.
Modify User – User ID
At times a user account might have been created with wrong user ID, hence to modify the user ID and
also you don’t want to have duplicate user ID, run the command;
usermod -u 1507 test.user1
Note: Existing User ID can’t be assigned to a user, a new User ID has to be assigned.
Modify User – Primary Group ID
If a user has been changed to a different project and you would like to change the group, run the
command;
usermod -g 1005 test.user2
Note: The existing primary group will be replaced.
How To Manage Linux User on RHEL 7
9 | P a g e
Modify User – Append Groups
If a user has been included to work on more than one project and user has to be appended to new groups.
To include user to additional groups, run the command;
usermod -aG 1003,1004 test.user3
Modify User – Move Home Directory
If you want to move home directory along with existing user files, run the command; give the new home
directory location for the user.
usermod -d /home/test.user4 -m test.user4
How To Manage Linux User on RHEL 7
10 | P a g e
Modify User – Comment
If you want to the change the comment of the exiting user, run the command;
usermod -c "Modified Comment" test.user5
cat /etc/passwd | grep -e "test.user5|Modified Comment"
Modify User – Login Name
If the user account was created with an wrong username and you intend change the login name, run the
command;
Note: The user's home directory or mail spool should probably be renamed manually to reflect the new
login name, see move home directory command.
usermod -l test.user6 changed.login.user
How To Manage Linux User on RHEL 7
11 | P a g e
Modify User – Login Shell
If you want to change the user’s login shell, run the command;
usermod -s /bin/sh test.user7
Modify User – Lock User
In order to lock a user account, when a user account is locked in “/etc/shadow” file against the user’s
password is prefixed with “!” which signifies that the account is locked.
usermod -L test.user8
How To Manage Linux User on RHEL 7
12 | P a g e
Modify User – Unlock User
In order to unlock a user account, when a user account is locked in “/etc/shadow” file against the user’s
password is prefixed with “!” which signifies that the account is locked. To revoke / unlock it run the
command;
usermod -U test.user8
User Management – USERDEL
In this section we will delete user account with different options, to delete a user execute the command
“userdel” as per the business need pass the optional parameters.
Delete User – Username
To delete a user and retain user’s files (home directory), run the command;
Note: If the user’s group is also primary group of any other user account, other user account will not be
deleted.
userdel test.user1
How To Manage Linux User on RHEL 7
13 | P a g e
Delete User – Home Directory
To delete a user and also user’s files (home directory), run the command;
userdel -r test.user2
Delete User – Force Removal
To delete a user by force, run the command;
userdel -f test.user4
Caution: Be careful when you remove user with force option, if there any processes running with this
account also will be ignored and user would be removed.
To delete a user by force along with user files also, run
userdel -rf test.user4

More Related Content

What's hot

How To Install OpenFire in CentOS 7
How To Install OpenFire in CentOS 7How To Install OpenFire in CentOS 7
How To Install OpenFire in CentOS 7VCP Muthukrishna
 
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...VCP Muthukrishna
 
How To View Login History and Logout History on RHEL 7
How To View Login History and Logout History on RHEL 7How To View Login History and Logout History on RHEL 7
How To View Login History and Logout History on RHEL 7VCP Muthukrishna
 
How To Install and Configure GNome on CentOS 7
How To Install and Configure GNome on CentOS 7How To Install and Configure GNome on CentOS 7
How To Install and Configure GNome on CentOS 7VCP Muthukrishna
 
VMWare Tools Installation and Troubleshooting Guide
VMWare Tools Installation and Troubleshooting GuideVMWare Tools Installation and Troubleshooting Guide
VMWare Tools Installation and Troubleshooting GuideVCP Muthukrishna
 
How To Configure Apache VirtualHost on RHEL 7 on AWS
How To Configure Apache VirtualHost on RHEL 7 on AWSHow To Configure Apache VirtualHost on RHEL 7 on AWS
How To Configure Apache VirtualHost on RHEL 7 on AWSVCP Muthukrishna
 
How To Install and Configure SUDO on RHEL 7
How To Install and Configure SUDO on RHEL 7How To Install and Configure SUDO on RHEL 7
How To Install and Configure SUDO on RHEL 7VCP Muthukrishna
 
How To Configure Nginx Load Balancer on CentOS 7
How To Configure Nginx Load Balancer on CentOS 7How To Configure Nginx Load Balancer on CentOS 7
How To Configure Nginx Load Balancer on CentOS 7VCP Muthukrishna
 
How to Manage journalctl Logging System on RHEL 7
How to Manage journalctl Logging System on RHEL 7How to Manage journalctl Logging System on RHEL 7
How to Manage journalctl Logging System on RHEL 7VCP Muthukrishna
 
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7VCP Muthukrishna
 
How To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellHow To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellVCP Muthukrishna
 
How to Install and Configure Cacti on Linux
How to Install and Configure Cacti on LinuxHow to Install and Configure Cacti on Linux
How to Install and Configure Cacti on LinuxVCP Muthukrishna
 
How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7VCP Muthukrishna
 
How To Install and Configure Open SSH Server on Ubuntu
How To Install and Configure Open SSH Server on UbuntuHow To Install and Configure Open SSH Server on Ubuntu
How To Install and Configure Open SSH Server on UbuntuVCP Muthukrishna
 
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7VCP Muthukrishna
 
How to Install Configure and Use sysstat utils on RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7How to Install Configure and Use sysstat utils on RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7VCP Muthukrishna
 
How To Install and Configure AWS CLI for Windows
How To Install and Configure AWS CLI for WindowsHow To Install and Configure AWS CLI for Windows
How To Install and Configure AWS CLI for WindowsVCP Muthukrishna
 
How To Install and Configure Screen on CentOS 7
How To Install and Configure Screen on CentOS 7How To Install and Configure Screen on CentOS 7
How To Install and Configure Screen on CentOS 7VCP Muthukrishna
 
Linux Basic Administration Commands Guide
Linux Basic Administration Commands GuideLinux Basic Administration Commands Guide
Linux Basic Administration Commands GuideVCP Muthukrishna
 
How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7VCP Muthukrishna
 

What's hot (20)

How To Install OpenFire in CentOS 7
How To Install OpenFire in CentOS 7How To Install OpenFire in CentOS 7
How To Install OpenFire in CentOS 7
 
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
 
How To View Login History and Logout History on RHEL 7
How To View Login History and Logout History on RHEL 7How To View Login History and Logout History on RHEL 7
How To View Login History and Logout History on RHEL 7
 
How To Install and Configure GNome on CentOS 7
How To Install and Configure GNome on CentOS 7How To Install and Configure GNome on CentOS 7
How To Install and Configure GNome on CentOS 7
 
VMWare Tools Installation and Troubleshooting Guide
VMWare Tools Installation and Troubleshooting GuideVMWare Tools Installation and Troubleshooting Guide
VMWare Tools Installation and Troubleshooting Guide
 
How To Configure Apache VirtualHost on RHEL 7 on AWS
How To Configure Apache VirtualHost on RHEL 7 on AWSHow To Configure Apache VirtualHost on RHEL 7 on AWS
How To Configure Apache VirtualHost on RHEL 7 on AWS
 
How To Install and Configure SUDO on RHEL 7
How To Install and Configure SUDO on RHEL 7How To Install and Configure SUDO on RHEL 7
How To Install and Configure SUDO on RHEL 7
 
How To Configure Nginx Load Balancer on CentOS 7
How To Configure Nginx Load Balancer on CentOS 7How To Configure Nginx Load Balancer on CentOS 7
How To Configure Nginx Load Balancer on CentOS 7
 
How to Manage journalctl Logging System on RHEL 7
How to Manage journalctl Logging System on RHEL 7How to Manage journalctl Logging System on RHEL 7
How to Manage journalctl Logging System on RHEL 7
 
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
 
How To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellHow To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShell
 
How to Install and Configure Cacti on Linux
How to Install and Configure Cacti on LinuxHow to Install and Configure Cacti on Linux
How to Install and Configure Cacti on Linux
 
How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7
 
How To Install and Configure Open SSH Server on Ubuntu
How To Install and Configure Open SSH Server on UbuntuHow To Install and Configure Open SSH Server on Ubuntu
How To Install and Configure Open SSH Server on Ubuntu
 
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
 
How to Install Configure and Use sysstat utils on RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7How to Install Configure and Use sysstat utils on RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7
 
How To Install and Configure AWS CLI for Windows
How To Install and Configure AWS CLI for WindowsHow To Install and Configure AWS CLI for Windows
How To Install and Configure AWS CLI for Windows
 
How To Install and Configure Screen on CentOS 7
How To Install and Configure Screen on CentOS 7How To Install and Configure Screen on CentOS 7
How To Install and Configure Screen on CentOS 7
 
Linux Basic Administration Commands Guide
Linux Basic Administration Commands GuideLinux Basic Administration Commands Guide
Linux Basic Administration Commands Guide
 
How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7
 

Viewers also liked

How To Configure FirewallD on RHEL 7 or CentOS 7
How To Configure FirewallD on RHEL 7 or CentOS 7How To Configure FirewallD on RHEL 7 or CentOS 7
How To Configure FirewallD on RHEL 7 or CentOS 7VCP Muthukrishna
 
How To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWSHow To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWSVCP Muthukrishna
 
How To Yum Package Installation
How To Yum Package InstallationHow To Yum Package Installation
How To Yum Package InstallationVCP Muthukrishna
 
How To Manage Services on RHEL 7 or CentOS 7
How To Manage Services on RHEL 7 or CentOS 7How To Manage Services on RHEL 7 or CentOS 7
How To Manage Services on RHEL 7 or CentOS 7VCP Muthukrishna
 
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7VCP Muthukrishna
 
How To Manage Yum Packages Interactive Shell
How To Manage Yum Packages Interactive ShellHow To Manage Yum Packages Interactive Shell
How To Manage Yum Packages Interactive ShellVCP Muthukrishna
 
How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7VCP Muthukrishna
 
LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7VCP Muthukrishna
 
How To Manage Yum Repositories
How To Manage Yum RepositoriesHow To Manage Yum Repositories
How To Manage Yum RepositoriesVCP Muthukrishna
 
How To Manage Yum Packages - Group Packages
How To Manage Yum Packages - Group PackagesHow To Manage Yum Packages - Group Packages
How To Manage Yum Packages - Group PackagesVCP Muthukrishna
 
Install Active Directory PowerShell Module on Windows 10
Install Active Directory PowerShell Module on Windows 10Install Active Directory PowerShell Module on Windows 10
Install Active Directory PowerShell Module on Windows 10VCP Muthukrishna
 
Configure Run Levels RHEL 7 or CentOS 7
Configure Run Levels RHEL 7 or CentOS 7Configure Run Levels RHEL 7 or CentOS 7
Configure Run Levels RHEL 7 or CentOS 7VCP Muthukrishna
 

Viewers also liked (17)

How To Configure FirewallD on RHEL 7 or CentOS 7
How To Configure FirewallD on RHEL 7 or CentOS 7How To Configure FirewallD on RHEL 7 or CentOS 7
How To Configure FirewallD on RHEL 7 or CentOS 7
 
DNF Failed To Open Cache
DNF Failed To Open CacheDNF Failed To Open Cache
DNF Failed To Open Cache
 
How To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWSHow To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWS
 
How To Yum Package Installation
How To Yum Package InstallationHow To Yum Package Installation
How To Yum Package Installation
 
How To Manage Services on RHEL 7 or CentOS 7
How To Manage Services on RHEL 7 or CentOS 7How To Manage Services on RHEL 7 or CentOS 7
How To Manage Services on RHEL 7 or CentOS 7
 
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
 
How To Manage Yum Packages Interactive Shell
How To Manage Yum Packages Interactive ShellHow To Manage Yum Packages Interactive Shell
How To Manage Yum Packages Interactive Shell
 
How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7
 
SystemD Usage Guide
SystemD Usage GuideSystemD Usage Guide
SystemD Usage Guide
 
LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7
 
How To List YUM Packages
How To List YUM PackagesHow To List YUM Packages
How To List YUM Packages
 
How To Manage Yum Cache
How To Manage Yum CacheHow To Manage Yum Cache
How To Manage Yum Cache
 
How To Manage Yum Repositories
How To Manage Yum RepositoriesHow To Manage Yum Repositories
How To Manage Yum Repositories
 
How To Manage Yum Packages - Group Packages
How To Manage Yum Packages - Group PackagesHow To Manage Yum Packages - Group Packages
How To Manage Yum Packages - Group Packages
 
How To Manage Yum History
How To Manage Yum HistoryHow To Manage Yum History
How To Manage Yum History
 
Install Active Directory PowerShell Module on Windows 10
Install Active Directory PowerShell Module on Windows 10Install Active Directory PowerShell Module on Windows 10
Install Active Directory PowerShell Module on Windows 10
 
Configure Run Levels RHEL 7 or CentOS 7
Configure Run Levels RHEL 7 or CentOS 7Configure Run Levels RHEL 7 or CentOS 7
Configure Run Levels RHEL 7 or CentOS 7
 

Similar to How To Manage Linux User on RHEL 7

User Administration in Linux
User Administration in LinuxUser Administration in Linux
User Administration in LinuxSAMUEL OJO
 
User and groups administrator
User  and  groups administratorUser  and  groups administrator
User and groups administratorAisha Talat
 
Addmi 06-security mgmt
Addmi 06-security mgmtAddmi 06-security mgmt
Addmi 06-security mgmtodanyboy
 
359555069 aae-control room-usermanual
359555069 aae-control room-usermanual359555069 aae-control room-usermanual
359555069 aae-control room-usermanualBishnujitBanerjee
 
User id installation and configuration
User id installation and configurationUser id installation and configuration
User id installation and configurationAlberto Rivai
 
Connect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceConnect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceVCP Muthukrishna
 
User and group administration in Linux
User and group administration in LinuxUser and group administration in Linux
User and group administration in LinuxMohammed Yazdani
 
List users in linux
List users in linuxList users in linux
List users in linuxLinuxConcept
 
How To Connect To Active Directory PowerShell
How To Connect To Active Directory PowerShellHow To Connect To Active Directory PowerShell
How To Connect To Active Directory PowerShellVCP Muthukrishna
 
How To Connect to Active Directory User Validation
How To Connect to Active Directory User ValidationHow To Connect to Active Directory User Validation
How To Connect to Active Directory User ValidationVCP Muthukrishna
 
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
A Complete Guide to “useradd” Command in Linux with Examples _ HostbilloA Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
A Complete Guide to “useradd” Command in Linux with Examples _ HostbilloKiyanaSharma1
 
Tips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxTips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxAgusto Sipahutar
 
Power Shell for System Admins - By Kaustubh
Power Shell for System Admins - By KaustubhPower Shell for System Admins - By Kaustubh
Power Shell for System Admins - By KaustubhKaustubh Kumar
 
Microsoft Offical Course 20410C_04
Microsoft Offical Course 20410C_04Microsoft Offical Course 20410C_04
Microsoft Offical Course 20410C_04gameaxt
 
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & TricksSoutheast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & TricksDave Stokes
 
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitPrivileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitVishal Kumar
 

Similar to How To Manage Linux User on RHEL 7 (20)

User Administration in Linux
User Administration in LinuxUser Administration in Linux
User Administration in Linux
 
User and groups administrator
User  and  groups administratorUser  and  groups administrator
User and groups administrator
 
sun solaris
sun solarissun solaris
sun solaris
 
Addmi 06-security mgmt
Addmi 06-security mgmtAddmi 06-security mgmt
Addmi 06-security mgmt
 
359555069 aae-control room-usermanual
359555069 aae-control room-usermanual359555069 aae-control room-usermanual
359555069 aae-control room-usermanual
 
User id installation and configuration
User id installation and configurationUser id installation and configuration
User id installation and configuration
 
Connect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceConnect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux Instance
 
User and group administration in Linux
User and group administration in LinuxUser and group administration in Linux
User and group administration in Linux
 
List users in linux
List users in linuxList users in linux
List users in linux
 
How To Connect To Active Directory PowerShell
How To Connect To Active Directory PowerShellHow To Connect To Active Directory PowerShell
How To Connect To Active Directory PowerShell
 
How To Connect to Active Directory User Validation
How To Connect to Active Directory User ValidationHow To Connect to Active Directory User Validation
How To Connect to Active Directory User Validation
 
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
A Complete Guide to “useradd” Command in Linux with Examples _ HostbilloA Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
 
Tips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptxTips On Trick Odoo Add-On.pptx
Tips On Trick Odoo Add-On.pptx
 
Power Shell for System Admins - By Kaustubh
Power Shell for System Admins - By KaustubhPower Shell for System Admins - By Kaustubh
Power Shell for System Admins - By Kaustubh
 
7 - User Administration in Red Hat
7 - User Administration in Red Hat7 - User Administration in Red Hat
7 - User Administration in Red Hat
 
Microsoft Offical Course 20410C_04
Microsoft Offical Course 20410C_04Microsoft Offical Course 20410C_04
Microsoft Offical Course 20410C_04
 
An Introduction to Drupal
An Introduction to DrupalAn Introduction to Drupal
An Introduction to Drupal
 
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & TricksSoutheast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
 
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitPrivileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
 
User management
User managementUser management
User management
 

More from VCP Muthukrishna

How to Fix Duplicate Packages in YUM on CentOS 7
How to Fix Duplicate Packages in YUM on CentOS 7How to Fix Duplicate Packages in YUM on CentOS 7
How to Fix Duplicate Packages in YUM on CentOS 7VCP Muthukrishna
 
How To List Files on Remote Server - PowerShell
How To List Files on Remote Server - PowerShellHow To List Files on Remote Server - PowerShell
How To List Files on Remote Server - PowerShellVCP Muthukrishna
 
How To List Files and Display In HTML Format
How To List Files and Display In HTML FormatHow To List Files and Display In HTML Format
How To List Files and Display In HTML FormatVCP Muthukrishna
 
How To Check and Delete a File via PowerShell
How To Check and Delete a File via PowerShellHow To Check and Delete a File via PowerShell
How To Check and Delete a File via PowerShellVCP Muthukrishna
 
How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7VCP Muthukrishna
 
Windows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics - How To List PSDrive InfoWindows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics - How To List PSDrive InfoVCP Muthukrishna
 
How To List Nginx Modules Installed / Complied on CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7How To List Nginx Modules Installed / Complied on CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7VCP Muthukrishna
 
Windows PowerShell Basics – How To Create powershell for loop
Windows PowerShell Basics – How To Create powershell for loopWindows PowerShell Basics – How To Create powershell for loop
Windows PowerShell Basics – How To Create powershell for loopVCP Muthukrishna
 
How To Construct IF and Else Conditional Statements
How To Construct IF and Else Conditional StatementsHow To Construct IF and Else Conditional Statements
How To Construct IF and Else Conditional StatementsVCP Muthukrishna
 
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create PowerShell Function Mandatory Parameter and Optional ParameterHow To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create PowerShell Function Mandatory Parameter and Optional ParameterVCP Muthukrishna
 
How To Create Power Shell Function Mandatory Parameter Value
How To Create Power Shell Function Mandatory Parameter ValueHow To Create Power Shell Function Mandatory Parameter Value
How To Create Power Shell Function Mandatory Parameter ValueVCP Muthukrishna
 
How To Create PowerShell Function
How To Create PowerShell FunctionHow To Create PowerShell Function
How To Create PowerShell FunctionVCP Muthukrishna
 
How To Disable IE Enhanced Security Windows PowerShell
How To Disable IE Enhanced Security Windows PowerShellHow To Disable IE Enhanced Security Windows PowerShell
How To Disable IE Enhanced Security Windows PowerShellVCP Muthukrishna
 
Nginx bind() to 0.0.0.0:9080 failed
Nginx bind() to 0.0.0.0:9080 failedNginx bind() to 0.0.0.0:9080 failed
Nginx bind() to 0.0.0.0:9080 failedVCP Muthukrishna
 
How To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on UbuntuHow To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on UbuntuVCP Muthukrishna
 
How To Configure SNMP Logging on RHEL 7
How To Configure SNMP Logging on RHEL 7How To Configure SNMP Logging on RHEL 7
How To Configure SNMP Logging on RHEL 7VCP Muthukrishna
 
How To Find Package Installation Date on RHEL 7
How To Find Package Installation Date on RHEL 7How To Find Package Installation Date on RHEL 7
How To Find Package Installation Date on RHEL 7VCP Muthukrishna
 
How To View Current Execution Policy PowerShell
How To View Current Execution Policy PowerShellHow To View Current Execution Policy PowerShell
How To View Current Execution Policy PowerShellVCP Muthukrishna
 

More from VCP Muthukrishna (18)

How to Fix Duplicate Packages in YUM on CentOS 7
How to Fix Duplicate Packages in YUM on CentOS 7How to Fix Duplicate Packages in YUM on CentOS 7
How to Fix Duplicate Packages in YUM on CentOS 7
 
How To List Files on Remote Server - PowerShell
How To List Files on Remote Server - PowerShellHow To List Files on Remote Server - PowerShell
How To List Files on Remote Server - PowerShell
 
How To List Files and Display In HTML Format
How To List Files and Display In HTML FormatHow To List Files and Display In HTML Format
How To List Files and Display In HTML Format
 
How To Check and Delete a File via PowerShell
How To Check and Delete a File via PowerShellHow To Check and Delete a File via PowerShell
How To Check and Delete a File via PowerShell
 
How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7
 
Windows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics - How To List PSDrive InfoWindows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics - How To List PSDrive Info
 
How To List Nginx Modules Installed / Complied on CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7How To List Nginx Modules Installed / Complied on CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7
 
Windows PowerShell Basics – How To Create powershell for loop
Windows PowerShell Basics – How To Create powershell for loopWindows PowerShell Basics – How To Create powershell for loop
Windows PowerShell Basics – How To Create powershell for loop
 
How To Construct IF and Else Conditional Statements
How To Construct IF and Else Conditional StatementsHow To Construct IF and Else Conditional Statements
How To Construct IF and Else Conditional Statements
 
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create PowerShell Function Mandatory Parameter and Optional ParameterHow To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
 
How To Create Power Shell Function Mandatory Parameter Value
How To Create Power Shell Function Mandatory Parameter ValueHow To Create Power Shell Function Mandatory Parameter Value
How To Create Power Shell Function Mandatory Parameter Value
 
How To Create PowerShell Function
How To Create PowerShell FunctionHow To Create PowerShell Function
How To Create PowerShell Function
 
How To Disable IE Enhanced Security Windows PowerShell
How To Disable IE Enhanced Security Windows PowerShellHow To Disable IE Enhanced Security Windows PowerShell
How To Disable IE Enhanced Security Windows PowerShell
 
Nginx bind() to 0.0.0.0:9080 failed
Nginx bind() to 0.0.0.0:9080 failedNginx bind() to 0.0.0.0:9080 failed
Nginx bind() to 0.0.0.0:9080 failed
 
How To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on UbuntuHow To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on Ubuntu
 
How To Configure SNMP Logging on RHEL 7
How To Configure SNMP Logging on RHEL 7How To Configure SNMP Logging on RHEL 7
How To Configure SNMP Logging on RHEL 7
 
How To Find Package Installation Date on RHEL 7
How To Find Package Installation Date on RHEL 7How To Find Package Installation Date on RHEL 7
How To Find Package Installation Date on RHEL 7
 
How To View Current Execution Policy PowerShell
How To View Current Execution Policy PowerShellHow To View Current Execution Policy PowerShell
How To View Current Execution Policy PowerShell
 

Recently uploaded

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Recently uploaded (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 

How To Manage Linux User on RHEL 7

  • 1. How To Manage Linux User on RHEL 7 i | P a g e Table of Contents Overview.......................................................................................................................................................1 Applies To......................................................................................................................................................1 User Management – Insight..........................................................................................................................1 User Type and Purpose.............................................................................................................................1 User ID and Group ID Range .....................................................................................................................1 User Login Shell.........................................................................................................................................2 User Add Options......................................................................................................................................2 User Management – USERADD.....................................................................................................................3 Create User – No Options .........................................................................................................................3 Create User – Set User ID..........................................................................................................................3 Create User – Set Group ID.......................................................................................................................4 Create User – Set Home Directory............................................................................................................4 Create User – Comment............................................................................................................................5 Create User – Login Shell ..........................................................................................................................5 Create User – Duplicate User ID ...............................................................................................................6 Create User – Account Expiry Date...........................................................................................................6 Create User – No Home Directory ............................................................................................................7 Create User – No Shell ..............................................................................................................................7 User Management – USERMOD....................................................................................................................8 Modify User – User ID...............................................................................................................................8 Modify User – Primary Group ID...............................................................................................................8 Modify User – Append Groups .................................................................................................................9 Modify User – Move Home Directory.......................................................................................................9 Modify User – Comment.........................................................................................................................10 Modify User – Login Name......................................................................................................................10 Modify User – Login Shell .......................................................................................................................11 Modify User – Lock User.........................................................................................................................11 Modify User – Unlock User .....................................................................................................................12 User Management – USERDEL....................................................................................................................12
  • 2. How To Manage Linux User on RHEL 7 ii | P a g e Delete User – Username.........................................................................................................................12 Delete User – Home Directory................................................................................................................13 Delete User – Force Removal..................................................................................................................13
  • 3. How To Manage Linux User on RHEL 7 1 | P a g e Overview The purpose of this guide is to help us in creating, remove or modify a user account on Linux server. In this guide we will focus on user add, removal and modifying. Applies To  Tested on CentOS 7 and RHEL 7 User Management – Insight In Linux users are managed by useradd, userdel and usermod commands. There are 3 types of users namely, Super User Account, System User Account, Normal Account User Type and Purpose User Type is defined and determined by User ID assigned to the user. Ideally only one super user should be created. User User Type User ID Group ID Information root Super 0 0 Also called root user apache System 1 1 Apache webserver owner and service account test.user Normal 500 500 Normal User Account User ID and Group ID Range User ID Range and Group ID Range is assigned is determined based on setting in the file “/etc/login.defs”. User Type UID Range GID Range Information Super 0 0 root user is always created with UID & GID 0 System 1 to 499 1 to 499 System account can be created within the range Normal 500 to 60000 500 to 60000 Normal account can be created within the range Note: Choosing the above UID & GID is advisable because of easier identification of user account type. cat /etc/login.defs | grep -e 'UID|GID'
  • 4. How To Manage Linux User on RHEL 7 2 | P a g e User Login Shell User’s Login shell can be assigned to a user as per the list in the file “/etc/shells”. This list is also supported shells on the servers. User Add Options In this section we will create user with few different options. In order to create a user you need provide mandatory “username” and all other attributes are optional. Option Purpose -u User Account’s User ID (number) -g User Account’s Group ID (number) -d Create Home Directory in path -c Comments for the user, typically User’s Full Name or profile -s User’s Login shell -o Create User with Existing user ID (duplicate) Defaults are determined based on the setting in the file “/etc/default/useradd” or execute command useradd -D.
  • 5. How To Manage Linux User on RHEL 7 3 | P a g e User Management – USERADD In this section we will create users with different options, to create a user execute the command “useradd” as per the business need pass the optional parameters. Create User – No Options To create user account, run the command; once you create the account, user’s login password has to be set with the command “passwd” as shown below; useradd test.user1 passwd test.user1 To know the User’s User ID run the command below; cat /etc/passwd | grep | test.user1 | awk -F":" '{ print "User " $1,"UID is "$3}' Create User – Set User ID To create a user account with a specific User ID, run the command; useradd -u 1500 test.user2 passwd test.user2
  • 6. How To Manage Linux User on RHEL 7 4 | P a g e Create User – Set Group ID To create a user account and assign to a specific Group ID, run the command, this group should already exists. useradd -g 100 test.user3 passwd test.user3 Create User – Set Home Directory To create a user account with a non-default home directory, run the command; useradd -d /home/appln.user test.user4 passwd test.user4
  • 7. How To Manage Linux User on RHEL 7 5 | P a g e Create User – Comment To create a user account with a comment, run the command; useradd -c "Test User #5" test.user5 passwd test.user5 Create User – Login Shell To create a user account with a non-default shell (bash), run the command; useradd -s /bin/sh test.user6 passwd test.user6
  • 8. How To Manage Linux User on RHEL 7 6 | P a g e Create User – Duplicate User ID To create a user account with non-unique user ID, run the command; useradd -ou 1500 test.user7 passwd test.user7 Create User – Account Expiry Date To create a user account with account expiry, run the command; Typically these accounts are created for a temporary time period. By default when you create a user without option “-e” user account is expiry date is set to “0”, which means account never expires. useradd -u 100 -e 2016-08-31 test.user8 passwd test.user8 chage -l test.user8
  • 9. How To Manage Linux User on RHEL 7 7 | P a g e Create User – No Home Directory To create a user account without home directory, run the command; useradd -g 100 -M test.user9 passwd test.user9 ls -l /home/test.user9 Create User – No Shell To create a user account without shell (user is restricted to login), run the command; useradd -g 100 -s /sbin/nologin test.user10 cat /etc/passwd | grep -E "test.user10| nologin"
  • 10. How To Manage Linux User on RHEL 7 8 | P a g e User Management – USERMOD In this section we will modify user account with different options, to modify a user execute the command “usermod” as per the business need pass the optional parameters. Modify User – User ID At times a user account might have been created with wrong user ID, hence to modify the user ID and also you don’t want to have duplicate user ID, run the command; usermod -u 1507 test.user1 Note: Existing User ID can’t be assigned to a user, a new User ID has to be assigned. Modify User – Primary Group ID If a user has been changed to a different project and you would like to change the group, run the command; usermod -g 1005 test.user2 Note: The existing primary group will be replaced.
  • 11. How To Manage Linux User on RHEL 7 9 | P a g e Modify User – Append Groups If a user has been included to work on more than one project and user has to be appended to new groups. To include user to additional groups, run the command; usermod -aG 1003,1004 test.user3 Modify User – Move Home Directory If you want to move home directory along with existing user files, run the command; give the new home directory location for the user. usermod -d /home/test.user4 -m test.user4
  • 12. How To Manage Linux User on RHEL 7 10 | P a g e Modify User – Comment If you want to the change the comment of the exiting user, run the command; usermod -c "Modified Comment" test.user5 cat /etc/passwd | grep -e "test.user5|Modified Comment" Modify User – Login Name If the user account was created with an wrong username and you intend change the login name, run the command; Note: The user's home directory or mail spool should probably be renamed manually to reflect the new login name, see move home directory command. usermod -l test.user6 changed.login.user
  • 13. How To Manage Linux User on RHEL 7 11 | P a g e Modify User – Login Shell If you want to change the user’s login shell, run the command; usermod -s /bin/sh test.user7 Modify User – Lock User In order to lock a user account, when a user account is locked in “/etc/shadow” file against the user’s password is prefixed with “!” which signifies that the account is locked. usermod -L test.user8
  • 14. How To Manage Linux User on RHEL 7 12 | P a g e Modify User – Unlock User In order to unlock a user account, when a user account is locked in “/etc/shadow” file against the user’s password is prefixed with “!” which signifies that the account is locked. To revoke / unlock it run the command; usermod -U test.user8 User Management – USERDEL In this section we will delete user account with different options, to delete a user execute the command “userdel” as per the business need pass the optional parameters. Delete User – Username To delete a user and retain user’s files (home directory), run the command; Note: If the user’s group is also primary group of any other user account, other user account will not be deleted. userdel test.user1
  • 15. How To Manage Linux User on RHEL 7 13 | P a g e Delete User – Home Directory To delete a user and also user’s files (home directory), run the command; userdel -r test.user2 Delete User – Force Removal To delete a user by force, run the command; userdel -f test.user4 Caution: Be careful when you remove user with force option, if there any processes running with this account also will be ignored and user would be removed. To delete a user by force along with user files also, run userdel -rf test.user4