How to grant sudo access?

QuestionsQuestions4 SkillsProUser Account ManagementOct, 07 2025
0120

To grant a user sudo access on a Linux system, you typically add the user to the sudo group or modify the /etc/sudoers file. Here’s how to do it:

Method 1: Adding User to the sudo Group

  1. Open a Terminal.
  2. Run the following command (replace username with the actual username):
    sudo usermod -aG sudo username
    
  3. Verify the User's Group: You can check if the user has been added to the sudo group by running:
    groups username
    

Method 2: Modifying the /etc/sudoers File

  1. Open the sudoers file using visudo (this prevents syntax errors):
    sudo visudo
    
  2. Add the following line at the end of the file (replace username with the actual username):
    username ALL=(ALL) ALL
    
  3. Save and exit the editor.

Example

To grant sudo access to a user named alice:

sudo usermod -aG sudo alice

Important Note

Always use visudo to edit the sudoers file to avoid syntax errors that could lock you out of sudo access.

If you have any further questions or need clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!