From 403a565d43a7eefff2f51d773f021e7235e5b970 Mon Sep 17 00:00:00 2001 From: litianci Date: Fri, 7 Oct 2022 00:45:08 +0800 Subject: [PATCH 1/4] Repair of format --- docs/books/admin_guide/06-users.md | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/books/admin_guide/06-users.md b/docs/books/admin_guide/06-users.md index 63aba5156f..6626efe837 100644 --- a/docs/books/admin_guide/06-users.md +++ b/docs/books/admin_guide/06-users.md @@ -606,7 +606,7 @@ chown --reference=/etc/groups /etc/passwd The command `gpasswd` allows to manage a group. ``` -gpasswd [-a login] [-A login] [-d login] [-M login] group +gpasswd [option] group ``` Examples: @@ -618,25 +618,33 @@ $ sudo gpasswd -A alain GroupA | Option | Description | | ---------- | ------------------------------------ | -| `-a login` | Adds the user to the group. | -| `-A login` | Sets the group administrator. | -| `-d login` | Remove the user from the group. | -| `-M login` | Defines the complete list of guests.| +| `-a USER` | Adds the user to the group. For user, this group is an supplementary group. | +| `-A USER,...` | Set the list of administrative users. | +| `-d USER` | Remove the user from the group. | +| `-M USER,...` | Set the list of group members.| The command `gpasswd -M` acts as a modification, not an addition. + ``` # gpasswd GroupeA New Password: Re-enter new password: ``` +!!! note + + In addition to using `gpasswd -a` to add users to a group, you can also use the `usermod -G` or `usermod -AG` mentioned earlier. + ### `id` command The `id` command displays the group names of a user. + ``` -id login +id USER ``` + Example: + ``` $ sudo id alain uid=1000(alain) gid=1000(GroupA) groupes=1000(GroupA),1016(GroupP) @@ -645,10 +653,13 @@ uid=1000(alain) gid=1000(GroupA) groupes=1000(GroupA),1016(GroupP) ### `newgrp` command The `newgrp` command allows you to temporarily use a secondary group for file creation. + ``` newgrp [secondarygroups] ``` + Example: + ``` [alain]$ newgrp GroupB ``` @@ -714,9 +725,11 @@ When managing user accounts by shell script, it may be useful to set a default p This can be done by passing the password to the `passwd` command. Example: + ``` $ sudo echo "azerty,1" | passwd --stdin philippe ``` + !!! Warning The password is entered in clear text, `passwd` takes care of encrypting it. @@ -724,10 +737,13 @@ $ sudo echo "azerty,1" | passwd --stdin philippe ### `chage` command The `chage` command is used to manage the account strategy. + ``` chage [-d date] [-E date] [-I days] [-l] [-m days] [-M days] [-W days] [login] ``` + Example: + ``` $ sudo chage -m 60 -M 90 -W 80 -I 10 alain ``` @@ -747,6 +763,7 @@ The `chage` command also offers an interactive mode. The `-d` option forces the password to be changed at login. Examples: + ``` $ sudo chage philippe $ sudo chage -d 0 philippe @@ -798,6 +815,7 @@ This file is modified by the command `useradd -D` (`useradd -D` entered without In order for the `useradd` command to retrieve the value of the `GROUP` field from the `/etc/default/useradd` file, you must specify the `-N` option. Example: + ``` $ sudo useradd -u 501 -N GroupeA ``` From 4705483e3cb5e2b30f007737c4c792152c590159 Mon Sep 17 00:00:00 2001 From: tianci li <86754294+jimcat8@users.noreply.github.com> Date: Fri, 7 Oct 2022 00:51:20 +0800 Subject: [PATCH 2/4] Update 06-users.md --- docs/books/admin_guide/06-users.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/books/admin_guide/06-users.md b/docs/books/admin_guide/06-users.md index 6626efe837..de29af661d 100644 --- a/docs/books/admin_guide/06-users.md +++ b/docs/books/admin_guide/06-users.md @@ -616,12 +616,12 @@ $ sudo gpasswd -A alain GroupA [alain]$ gpasswd -a patrick GroupA ``` -| Option | Description | -| ---------- | ------------------------------------ | -| `-a USER` | Adds the user to the group. For user, this group is an supplementary group. | -| `-A USER,...` | Set the list of administrative users. | -| `-d USER` | Remove the user from the group. | -| `-M USER,...` | Set the list of group members.| +| Option | Description | +| ---------- | ------------------------------------ | +| `-a USER` | Adds the user to the group. For user, this group is an supplementary group. | +| `-A USER,...` | Set the list of administrative users. | +| `-d USER` | Remove the user from the group. | +| `-M USER,...` | Set the list of group members.| The command `gpasswd -M` acts as a modification, not an addition. From 5ab4621ef274ece79f5b83e099aea11849cd7651 Mon Sep 17 00:00:00 2001 From: Ezequiel Bruni Date: Thu, 6 Oct 2022 15:43:15 -0700 Subject: [PATCH 3/4] Update docs/books/admin_guide/06-users.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Serge Croisé --- docs/books/admin_guide/06-users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/books/admin_guide/06-users.md b/docs/books/admin_guide/06-users.md index de29af661d..bc68dfec9c 100644 --- a/docs/books/admin_guide/06-users.md +++ b/docs/books/admin_guide/06-users.md @@ -618,7 +618,7 @@ $ sudo gpasswd -A alain GroupA | Option | Description | | ---------- | ------------------------------------ | -| `-a USER` | Adds the user to the group. For user, this group is an supplementary group. | +| `-a USER` | Adds the user to the group. For the added user, this group is a supplementary group. | | `-A USER,...` | Set the list of administrative users. | | `-d USER` | Remove the user from the group. | | `-M USER,...` | Set the list of group members.| From 0559628197b6afce513b2913ab64b31055a4dc97 Mon Sep 17 00:00:00 2001 From: Ezequiel Bruni Date: Thu, 6 Oct 2022 17:48:05 -0500 Subject: [PATCH 4/4] Update 06-users.md --- docs/books/admin_guide/06-users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/books/admin_guide/06-users.md b/docs/books/admin_guide/06-users.md index bc68dfec9c..490dd3c35d 100644 --- a/docs/books/admin_guide/06-users.md +++ b/docs/books/admin_guide/06-users.md @@ -827,7 +827,7 @@ This file contains many default parameters useful for creating or modifying user * Mailboxes; * Passwords; * UID and GID; -* Umask ; +* Umask; * Connections; * Terminals.