diff --git a/source/Installation/linux_admin.rst b/source/Installation/linux_admin.rst index 8f17b6a877068293961eafe727d023f8b4850bdf..0a9bfe69bef109cb5db72553f78c98a7b3f52a51 100644 --- a/source/Installation/linux_admin.rst +++ b/source/Installation/linux_admin.rst @@ -146,6 +146,46 @@ Create a new user Only root can perform this command. +Delete a user +============= + +.. code-block:: shell + + userdel [OPTIONS] USERNAME + +.. code-block:: shell + + userdel username + +The command above remove the user <username> from the system. +But does not remove it's home directory +To do this use the `-r` option + +.. code-block:: shell + + userdel -r username + +.. warning:: + + Before to remove a user from the system ensure that he has no job running. + Kill all jobs run by user + + .. code-block:: shell + + sudo killall -u username + + Also ensure that he is not logged or force to logout + + .. code-block:: shell + + sudo userdel -f username + + of course you can use `-r` and `-f` on same command. + + .. code-block:: shell + + sudo userdel -rf username + create new group ================ @@ -158,6 +198,46 @@ Only root can perform this command. To take into account new user and group you need to logout and login again. +Delete a Group +============== + +.. code-block:: shell + + sudo groupdel groupname + +Add an Existing User to a Group +=============================== + +.. code-block:: shell + + sudo usermod -a -G <group> <login> + +for instance to add the user `zeus` in group `viro` + +.. code-block:: shell + + sudo usermod -a -G viro zeus + +Always use the `-a` (append) option when adding a user to a new group. +If you omit the -a option, the user will be removed from any groups not listed after the `-G` option. + +On success, the usermod command does not display any output. +It warns you only if the user or group doesn’t exist. + +.. code-block:: shell + + sudo usermod -a -G group1,group2 username + +Add username to group1 and group2 in one command + +Remove a User From a Group +========================== + +.. code-block:: shell + + sudo gpasswd -d username groupname + + Check you identity ==================