Here's a short guide on how to add a user to the sudoers file and grant them full administrative permissions on a Debian system:

  1. Add the user to the sudo group: Assuming the username is username, add the user to the sudo group. This group has sudo privileges by default.

    sudo usermod -aG sudo username
    
  2. Verify the user is added to the sudo group: Check the group membership of the user to ensure they have been added to the sudo group.

    groups username
    
  3. Edit the sudoers file (optional): If you need to provide specific permissions or want to manually add the user to the sudoers file, use the visudo command to safely edit the file:

    sudo visudo
    
  4. Add user with full sudo permissions: Within the visudo file, add the following line to grant full sudo permissions to the user username:

    username ALL=(ALL:ALL) ALL
    
  5. Save and exit: If using the default editor (nano), save the file by pressing Ctrl+O, then press Enter to confirm. Exit the editor by pressing Ctrl+X.

  6. Test the sudo access: Switch to the user and test if they have sudo privileges:

    su - username
    sudo ls /root
    

    The command should prompt for the user's password and then list the contents of the /root directory if the user has proper sudo access.

That's it! The user username should now have full administrative permissions using sudo.

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9