add user to group

# official, cross distribution (tested with suse12, centos7, debian8)
usermod -a -G GROUPNAME USERNAME

# redhat/centos:
usermod -a -G wheel user; # add user „user“ to group „wheel“ in order to allow user to use sudo

# debian:
usermod -a -G sudo user; # allows user bob to run processes with root-privileges temporarily

# debian8 only
adduser username group; # add username to the group
adduser user lpadmin; # adds the user "user" to the group "lpadmin" (if cups installed allows the user to add/delete printers)

User will have to re-login to active changes! (this could mean a reboot)

examples:

for example, when the user “user” wants to use kvm virtualization, for this the user needs to be in the libvirt group.

su - root
# what groups are there?
cat /etc/group|grep libvirt
libvirt:x:128:user
libvirt-qemu:x:64055:libvirt-qemu
libvirtdbus:x:129:

# add user "user" to group "libvirt"
usermod -a -G libvirt user

# then completely close all programs and log out of the system
# for 100% complete logout: to apply changes
reboot

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin