Add / Create a Sudo User on CentOS Linux 8 sudoers

https:/‮www/‬.lautturi.com
Add / Create a Sudo User on CentOS Linux 8 sudoers

To add a sudo user on CentOS Linux 8, you will need to log in as the root user or another user with sudo privileges. Once logged in, you can use the following steps to add a new user and grant them sudo privileges:

  1. Use the useradd command to create a new user account. Replace <username> with the desired username for the new account:
useradd <username>
  1. Set a password for the new user account with the passwd command. Replace <username> with the username of the new account:
passwd <username>
  1. Use the visudo command to open the /etc/sudoers file in a text editor. This file controls who is allowed to use the sudo command.
visudo
  1. Add the following line to the file, replacing <username> with the username of the new user account:
<username> ALL=(ALL) ALL
  1. Save and exit the /etc/sudoers file. The new user should now be able to use the sudo command to run commands with elevated privileges.

Note: It is recommended to use the visudo command to edit the /etc/sudoers file, as it checks the file for syntax errors before saving it. This helps to prevent accidentally breaking the sudo configuration, which could prevent users from being able to use sudo.

Created Time:2017-10-16 13:55:57  Author:lautturi