User accounts: Difference between revisions

→‎Groups: add list user groups & check primary group
→‎Groups: add list user groups & check primary group
Line 26: Line 26:
or
or
$ sudo usermod -a -G groupname username // for an existing user
$ sudo usermod -a -G groupname username // for an existing user
</syntaxhighlight>
== List a user's groups ==
<syntaxhighlight lang="bash">
$ id -Gn username
</syntaxhighlight>
== Check a user's primary group ==
<syntaxhighlight lang="bash">
$ getent group username
</syntaxhighlight>
</syntaxhighlight>