- Log in as the root user:
sudo su
- Create a new user:
useradd <username>
- Set the password for the new user:
passwd <username>
- Add the new user to the sudo group:
usermod -aG wheel <username>
- Verify that the user has been added to the sudo group:
grep wheel /etc/group
- Log out and log in as the new user to verify that you can use the sudo command.
Note: The above commands are for CentOS 8, for other version of Linux the commands may slightly vary.