Oracle Linux Basic Administration Series - Part 4 - How to Manage Users and Groups in Oracle Linux
- Jason Beattie
- 19 hours ago
- 2 min read
User and group management is one of the most important skills for any Linux system administrator.It’s essential for controlling who can access the system, what permissions they have, and how they interact with files and services.
In this blog, we’ll cover how to create, modify, and delete users and groups, set passwords, and manage privileges on Oracle Linux.
Step 1: Understanding Users and Groups
Linux:
A user represents a person or process that can log in and execute tasks.
A group is a collection of users that share permissions.
User and group details are stored in:
/etc/passwd → user account info
/etc/shadow → encrypted passwords
/etc/group → group info
To view these files:
cat /etc/passwd
cat /etc/group
Step 2: Creating a New User
Use the useradd command:
sudo useradd usernameExample:
Now, set a password for the new user:

You’ll be prompted to enter and confirm the password.
Step 3: Creating a User with Custom Options
You can customize the user’s home directory, shell, and UID (user ID).
Example:
sudo useradd -d /data/joe_home -s /bin/bash joeExplanation:
-d → custom home directory
-s → specifies login shell

Step 4: Modifying an Existing User
Change the username:
sudo usermod -l newname oldnameChange the home directory:
sudo usermod -d /new/home/path usernameAdd a user to an existing group:
sudo usermod -aG groupname usernameExample:

(The “wheel” group allows administrative privileges using sudo.)
Step 5: Deleting Users
To delete a user but keep their files:
sudo userdel usernameTo delete the user and their home directory:

Step 6: Managing Groups
Create a new group:
sudo groupadd developersAdd a user to a group:
sudo usermod -aG developers joeView group membership:
groups joe
Delete a group:
sudo groupdel developersStep 7: Granting Sudo (Admin) Privileges
Users in the wheel group can run administrative commands with sudo.
Add a user to the wheel group:
sudo usermod -aG wheel joeVerify:
groups joeTo test:
su - joe

Step 8: Understanding Important Files
To safely edit sudoers:
sudo visudoAdd a line like:
joe ALL=(ALL) ALL
Step 9: Check User and Group Details
Display current logged-in user:
whoamiShow user details:
id usernameExample:
uid=1001(joe) gid=1001(joe) groups=1001(joe),10(wheel)
Step 10: Locking and Unlocking Accounts
To temporarily lock a user:
sudo passwd -l joeTo unlock:
sudo passwd -u joeConclusion
You now know how to manage users and groups — one of the cornerstones of Linux administration. With these commands, you can securely manage access and assign the right privileges to each user.
In the next post, we’ll move on to file permissions and ownership, where we’ll control what users and groups can do with files and directories.



Comments