To add a user to the sudo group, you can use the usermod command with the -aG option. Here’s how to do it:
Syntax
sudo usermod -aG sudo username
Steps
Open a Terminal.
Run the Command: Replace
usernamewith the actual username you want to add to thesudogroup. For example, to add a user namedjoker, you would run:sudo usermod -aG sudo jokerVerify the Change: To confirm that the user has been added to the
sudogroup, you can check the groups the user belongs to:groups jokerYou should see
sudolisted among the groups.
Note
- Make sure you have the necessary permissions to run the
usermodcommand. - Adding a user to the
sudogroup grants them administrative privileges, so do this cautiously.
