Professional Documents
Culture Documents
1. Open a terminal and run the following command to edit the sudoers file:
sudo visudo
Locate the section in the sudoers file where user privileges are defined. It should have a line that
looks like:
Below the root entry, add a new line for the user you want to grant restricted sudo access.
Replace <username> with the actual username of the user:
Replace /path/to/allowed/command with the full path to the specific command or commands that
the user is allowed to execute with sudo . For example, if you want to allow the user to run the ls
command, the line would look like this:
After making these changes, the user will have restricted sudo access and will only be
able to execute the specified command(s) with sudo. They won't have full administrative
privileges. Make sure to double-check the syntax and save the file correctly, as incorrect
changes to the sudoers file can cause issues with system administration.