Add User to Root Group Linux

To add a user to the root group, you can follow these steps:

  1. Open the terminal and use the following command to add a user to the root group:
sudo usermod -aG root username

The “username” here refers to the username of the user to be added to the root group.

  1. Make sure that the user has logged out and logged back in to apply the changes.
  2. You can use the following command to verify if a user has been successfully added to the root group:
groups username

The “username” here refers to the username of the user to be checked. If the user has been successfully added to the root group, all groups including the root group will be displayed.

bannerAds