e Learning

How to Add User to wheel group in CentOS 7

In CentOS 7 members of the wheel group can run linux commands with sudo privileges. In This tutorial we are going to learn how to add user to wheel group in CentOS 7.

To add a user to the wheel group in CentOS 7 we can use either usermod or gpasswd command.

Add User to wheel group using usermod command

In usermod command -G option use to specify the group that user wants be added.(if -a options is not used user will be removed from other groups he is already a member of).

usermod -a -G wheel username

Example

usermod -a -G wheel jon

The above example will add the user jon to the CentOS 7 wheel group.

Add user to wheel group in CentOS 7 using gpasswd command

Command option -a use to add a user to group in gpasswd command.

gpasswd -a username wheel

Example

gpasswd -a admin wheel

Above Example will add user admin to the CentOS 7 wheel group.

Remove user from wheel group in CentOS 7

The gpasswd command also use to remove a user from the wheel group. To remove a user we use -d option.

Example

gpasswd -d admin wheel

Above Command will remove user admin from the wheel group.