m
→‎Adding sudoers: add few sections
Tag: visualeditor
 
(5 intermediate revisions by the same user not shown)
Line 20: Line 20:
== Add a user to a group ==
== Add a user to a group ==


<syntaxhighlight lang="bash">
<source lang="bash">
$ sudo adduser username groupname
$ sudo adduser username groupname
or
or
$ sudo useradd -a G groupname username
$ sudo useradd -G groupname username  // for a new user
or
$ sudo usermod -a -G groupname username // for an existing user
</source>
 
== Remove a user from a group ==
 
<source lang="bash">
$ sudo gpasswd -d username groupname
</source>
 
== 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>


Line 43: Line 63:


== Set a directory writable by a certain group ==
== Set a directory writable by a certain group ==
Turn on the SGID bit for the root folder
<source lang="bash">
$ sudo chmod g+s www
</source>


Make /srv/www folder readable/writable/executable by dev group
Make /srv/www folder readable/writable/executable by dev group