Quick Fix: Add a User to a Group from the CLI

kontact_contacts.pngOnce you know how to do it, adding an existing user to an existing group from the console is a lot faster than using any GUI. To add the user exit to the group mail:

adduser exit mail

To remove the user exit from the group mail:

deluser exit mail

Both these commands require administrative privileges (obviously). So call them with sudo or from a root shell. If you’re changing your own groups, you will need to log out and in again to see the changes.

Note that there is a related command, usermod -G mail exit, but it probably won’t do what you want, since it removes the user from any groups he is part of, and adds him to the group mail, only. You can use it in this form, though:

usermod -G mail,admin,floppy,cdrom,scanner,audio,video exit

but it’s a lot clumsier if you ask me.

Comments are closed.

%d bloggers like this: