How to add user into admin group on CentOS
Introduction
Managing user access and permissions is a critical aspect of system administration. In CentOS, adding a user to the administrator group is a straightforward process that requires specific commands. This blog post outlines the steps to add a user to the admin group in CentOS.
Adding a user to the admin group
To add a user to the admin group, you need to execute the following steps:
- Log in as the root user or a user with sudo privileges.
- Open the terminal and run the following command to add the user to the admin group:
sudo usermod -aG wheel {username}
Ensure you replace ‘{username}’ with the actual username of the user you want to add to the admin group.
- Once the command executes successfully, the user can now perform administrative tasks by running sudo before any command.
Understanding the admin group in CentOS
The admin group in CentOS is a group that has sudo privileges. This group is also referred to as the sudoers group. Members of this group can run administrative tasks on the system, including running commands with elevated privileges. By default, the first user created during CentOS installation is added to the admin group.
Removing a user from the admin group
If you wish to remove a user from the admin group, you need to execute the following steps:
- Log in as the root user or a user with sudo privileges.
- Open the terminal and run the following command to remove the user from the admin group:
sudo gpasswd -d {username} wheel
Ensure you replace ‘{username}’ with the actual username of the user you want to remove from the admin group.
- Once the command executes successfully, the user will no longer be able to perform administrative tasks on the system.
Conclusion
Adding a user to the admin group in CentOS is an important task that enables the user to perform administrative tasks on the system. The process is straightforward and can be executed in a few steps. It’s essential to manage user access and permissions carefully to ensure system security and stability.
Leave a message
Disclaimer
- Welcome to visit the knowledge base of SRE and DevOps!
- License under CC BY-NC 4.0
- Made with Material for MkDocs and improve writing by generative AI tools
- Copyright issue feedback me#imzye.com, replace # with @