usermod

On CentOS, the wheel group allows users in this group to run commands as user root with sudo.

To add a user to the wheel group, run

usermod -aG wheel USERNAME

On Ubuntu/Debian, use

usermod -aG sudo USERNAME

Remove a User from Group

deluser USERNAME GROUP

Example

root@ip-172-31-56-4:~# deluser designware sudo
Removing user `designware' from group `sudo' ...
Done.
root@ip-172-31-56-4:~# 

Here we remove user designware from group sudo.

To remove a user from all secondary groups, run

usermod -G "" USERNAME

Change user shell

To disable SSH login, run

usermod -s /sbin/nologin USERNAME

For example

usermod -s /sbin/nologin mysql

useradd

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *