
Another way to test this is to run the following command: $ sudo whoami If everything is OK, the command will list all the content in the /root directory.

#ADD USER TO SUDOERS PASSWORD#
You will need to enter the password for the new user to proceed. Try to run the same command, now with using sudo $ sudo ls -ls /root/ You will get the following error message: ls: cannot open directory /root/: Permission denied Now run a command that usually doesn’t work for regular users like the one below: $ ls -la /root/ To switch to the new user, run the following command: # su - newuser Now that your new user is set up you can switch to that user and test if everything is OK. It should look exactly like this: # Allows people in group wheel to run all commands Make sure that the line that starts with %wheel is not commented.

Now, use visudo to open and edit the /etc/sudoers file. You can do that by using the following command: # usermod -aG wheel newuserĪgain, make sure you are using the name of the actual user instead of newuser. Therefore, you need to add the new user to this group so it can run commands as superuser. The wheel group is a special user group that allows all members in the group to run all commands. Passwd: all authentication tokens updated successfully. You will be asked to enter the password again and once you enter it you will be notified that the authentication tokens are updated successfully: # passwd newuser Make sure you are using a strong password, otherwise the password will fail against the dictionary check.

To set up a password you can use the following command: # passwd newuser Also, you need to set up a password for the newly added user. You need to replace newuser with the name of the user you want to add. You can add a new system user using the following command: # adduser newuser Once you are logged in, you need to add a new system user. Add User to the Wheel Group in CentOSįirst of all, connect to your server via SSH.
