How to add user privileges?

QuestionsQuestions8 SkillsProPermissions of FilesNov, 27 2025
053

To add user privileges in Linux, particularly for granting sudo access, follow these steps:

  1. Open the Terminal.

  2. Use the usermod Command: To add a user to the sudo group (which grants them sudo privileges), use the following command:

    sudo usermod -aG sudo username

    Replace username with the actual username of the user you want to grant privileges to.

  3. Verify Group Membership: You can check if the user has been added to the sudo group by running:

    groups username
  4. Edit the Sudoers File (Optional): If you want to specify more granular permissions, you can edit the /etc/sudoers file using visudo:

    sudo visudo

    Add a line for the user or group, for example:

    username ALL=(ALL) ALL
  5. Save and Exit: If you edited the sudoers file, save your changes and exit the editor.

  6. Test the Configuration: Have the user log out and back in, then test by running a command with sudo to ensure they have the expected privileges.

By following these steps, you can successfully add user privileges in a Linux environment.

0 Comments

no data
Be the first to share your comment!