-
Log in to the system as root user.
-
Execute the following command to edit the sudoers file:
visudo
Note: Be sure
visudo
to edit the sudoers file using the command rather than editing the file directly. -
In the opened sudoers file, find the section starting with "# User privilege specification".
-
At the end of the section add a line similar to
<username> ALL=(ALL) ALL
where<username>
is the username you want to add.For example, if you want to add user "going" to the sudoers file, the line might read:
going ALL=(ALL) ALL
-
Save and exit the file.
After adding a user to the sudoers file, the user will have permission to execute sudo commands.
Please note that you must be careful when modifying the sudoers file to ensure that only necessary users are assigned sudo privileges and follow security best practices. Verify the user's identity and permissions and avoid adding unnecessary rules in the sudoers file.