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:
Add the user to the sudo group: Assuming the username is
username, add the user to thesudogroup. This group has sudo privileges by default.sudo usermod -aG sudo username
Verify the user is added to the sudo group: Check the group membership of the user to ensure they have been added to the
sudogroup.groups usernameEdit the sudoers file (optional): If you need to provide specific permissions or want to manually add the user to the sudoers file, use the
visudocommand to safely edit the file:sudo visudoAdd user with full sudo permissions: Within the
visudofile, add the following line to grant full sudo permissions to the userusername:username ALL=(ALL:ALL) ALL
Save and exit: If using the default editor (
nano), save the file by pressingCtrl+O, then pressEnterto confirm. Exit the editor by pressingCtrl+X.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
/rootdirectory if the user has proper sudo access.
That's it! The user username should now have full administrative permissions using sudo.
