Wednesday, January 9, 2013

openSUSE: Add user to group

Adding a user to a group on openSUSE is easy:
  • Read The Fine Manual
    $ man usermod
    
  • Become root
  • Check if the group exists, and if it doesn't, create it
    # groupadd mygroup
    groupadd: group 'mygroup' already exists
    
  • Add user to the group
    # usermod -a -G mygroup myuser
    

There are caveats, of course. For example, the above doesn't work when using LDAP/Kerberos login:
# usermod -a -G vboxusers borlbej
usermod: Account `borblej' does not exist.

In openSUSE, we use Yast (Security and Users -> User and Group Management) for this. (Hint: "Set Filters".)

In the old days, we would typically just edit /etc/group directly.

The new group setting takes effect only after logging out and logging back in. If using a desktop environment, one must log out of the desktop, not just close the terminal window.

No comments:

Post a Comment