Today on this article about user account management i will try to explain how Red Hat manage the users and groups creation and management.
For instance on Linux everything is represented by a file, all files are associated with a user. All users belong to a group with the same name as the username of the user, one user can be on many groups. we have three different ways to create users by manual editing system files and using command line tools like useradd the last way is from GUI.
Users home directory are located at /home/username and are created automatically based on a skeleton located at /etc/skel .
RHCSA Exams Topics
- User Account Management
- Administrative Control
- User and Shell Configuration
- Users and Network Authentication
- Special Groups
User Account Management Actions
On this mini tutorial i will covered some basic actions on Linux Systems related to user account management, as an system administrator there are some basic actions we can make like create, delete and modify users. You can check all options using man command (man useradd).
- useradd – Create User
- userdel – Delete User
- usermod – Modify User Account
- passwd – Define User Password
- User Configs & Home Directory
User Account Management – Types of Users
Linux system have three basic types of users accounts each one of them have a UID range associated with it. We will learn how to verify and change user UIDs on our system.
The root user is created when the system is installed, this user has the UID equal to Zero (0) and have permissions to access all services and files on the system. For instance keep this account secure and avoid share the root password with anyone.
These type of accounts are used by system services like apache, mysql, squid or email service they have UIDs between 1 and 999.
Regular accounts are users with limited permissions defined by the system administrator to execute standard procedures the UID range associated with them are between 1000 and 65535.
|User Type||UID Range||Description|
RHCSA Create User
To create a new user on Linux we have two options, use the default options specified on /etc/skel directory and /etc/default/useradd or pass the specific configuration as a parameter to the useradd command. Before start adding users to the system check all parameters with #man useradd command.
# useradd poplab
# useradd -D -U -m -s /bin/bash poplab
RHEL Add User to Group
After create a new user most of times we need to add it to a group or many groups, remember the parameter -a (Append).
# usermod -aG security,wheel poplab
RHCSA Define User Password
To define a username password we have the passwd command
# passwd poplab
RHCSA Delete User Account
# userdel poplab
User Account Management – User Info Commands
Sometimes we need to troubleshoot or create a new specific account, being able to verify all account information related to a user or a file is a bonus. Sometimes we ask a few questions to ourselves on our daily work:
How to check the user and group id?
Print logged user and user group IDs
# id # id poplab
Verify all data about the id command
# man id
How to check user information?
Display information about known users in the system # lslogins # lslogins poplab
Files Related to Users
- /etc/passwd – User account information.
- /etc/shadow – Secure user account information.
- /etc/default/useradd – Default values for account creation.
- /etc/login.defs – Shadow password suite configuration.
Folders Related to Users
- /home/username – User Home Directory
- /etc/skel/ – Directory Containing default files