User accounts: Difference between revisions

Jump to navigation Jump to search
→‎Groups: add other sections
No edit summary
→‎Groups: add other sections
Line 4: Line 4:
== Add a new group ==
== Add a new group ==


<source lang="bash">
<syntaxhighlight lang="bash">
$ sudo addgroup webdev
$ sudo addgroup webdev
</source>
or
$ sudo groupadd webdev
</syntaxhighlight>


== Delete a group ==
== Delete a group ==


<source lang="bash">
<syntaxhighlight lang="bash">
$ sudo delgroup webdev
$ sudo delgroup webdev
</source>
or
$ sudo groupdel webdev
</syntaxhighlight>


== Add a user to a group ==
== Add a user to a group ==


<source lang="bash">
<syntaxhighlight lang="bash">
$ sudo adduser username groupname
$ sudo adduser username groupname
</source>
or
$ sudo useradd -a G groupname username
</syntaxhighlight>
 
== Change a user's primary group ==
 
<syntaxhighlight lang="bash">
$ sudo usermod -g groupname username
</syntaxhighlight>
 
== Check user's group assignments ==
 
<syntaxhighlight lang="bash">
$ id username
or
$ groups username
or
$ id -Gn username
</syntaxhighlight>


== Set a directory writable by a certain group ==
== Set a directory writable by a certain group ==

Navigation menu