Introduction
The content of this article is showing on how to add user as a super user. Actually, adding a user in the installation process does not guarantee that the user will have a root privilege. So, in order for a normal user to run a privileged command where only root can be able to execute, perform another step. Just modify the user privilege. Actually, modifying the user in this context means adding the user to be a super user. The following are steps for achieving the purpose :
1. If the virtual server is running on a Virtual Machine Manager such as VirtualBox, just access it. In other words, access the virtual server directly using the VirtualBox Manager. The following image is showing access as root via VirtualBox application. As root account, execute the following command :
As in the above output, there is a specific command for modifying the group of a user account. The following is the pattern of the command execution :
usermod user_name -G group_name
The group available in the CentOS operating system with a root privilege normally has the name of ‘wheel’ or ‘adm’. That group name is ‘wheel’ in CentOS 8. So, just execute the above command pattern using a user name example ‘admin’ as follows :
usermod admin -G wheel
Furthermore, in order to check whether the user has the group of wheel, execute the following command :
groups admin
2. If the virtual server is running on a VirtualBox manager but it can accept incoming connection using SSH remote access, just try it. Just look at the previous article with the title of ‘How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH’ in this link. The following is an image connecting to the virtual server using SSH remote access :
3. Just perform the command above. Do it after successfully logging in to the virtual server. It is an indirect access from the host to the guest virtual server using SSH remote access. Similarly, the command execution is the exact same command as in the second step.
The following is the image display of the above command :
Sudo File Configuration
Actually, adding the normal user to a certain group is one of the method to achieve it. It will escalate or to change the privilege of the normal user to have the same privilege of that group. The group must have the same privilege with the super user account. The name of the group exist in the sudo file configuration. The name is available upon executing a ‘visudo’ command using the root account as follows :
[root@10 ~]# visudo visudo: /etc/sudoers.tmp unchanged [root@10 ~]# groups admin admin : admin wheel [root@10 ~]#
So, the reference for setting the normal user ‘admin’ into a group with a root privilege exist in that file. In that file, there is a group name with the root or super user privilege. The above command execution of ‘visudo’ is actually directly edit a file. That file name has the name of ‘sudoers’. It exists in the ‘/etc’ path. Furthermore, the command execution above resulting on nothing happen. Actually, it is still left unchanged because nothing is being edited. Moreover, that is because the purpose for adding the normal user ‘admin’ is already fulfilled. So, it is done after adding that user to the group. That group name is ‘wheel’.
The following is the image is part of ‘/etc/sudoers’ file where it points that information part :
The image that pointing the ‘wheel’ group can run all commands is in the following line :
%wheel ALL=(ALL) ALL
One thought on “How to Add User as Super User in CentOS 8 running in a VirtualBox Application”