Skip to main content

How To Create a Sudo User on CentOS 7/8

 

The sudo command provides a mechanism for granting administrator privileges, ordinarily only available to the root user, to normal users. This guide will show you the easiest way to create a new user with sudo access on CentOS, without having to modify your server’s sudoers file. If you want to configure sudo for an existing user, simply skip to step 3.

  1. Log in to your server as the root user.
    ssh root@{server_ip_address}
  2. Use the adduser command to add a new user to your system.
    adduser {username}
  3. Use the passwd command to update the new user’s password.
    passwd {username}
  4. Use the usermod command to add the user to the wheel group.
    usermod -aG wheel {username}
  5. add user to a {nginx} group
    usermod -a -G {username} nginx

If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.

 

Tags