Users Linux

 

List User Linux

compgen -u

 

How to Add an Existing User to a Group

To add an existing user to a secondary group, use the usermod -a -G command followed the name of the group and the user:

sudo usermod -a -G groupname username

For example, to add the user linuxize to the sudo group, you would run the following command:

sudo usermod -a -G sudo linuxize

Always use the -a (append) option when adding a user to a new group. If you omit the -a option, the user will be removed from any groups not listed after the -G option.

On success, the usermod command does not display any output. It warns you only if the user or group doesn’t exist.













Leave a Reply

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