English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Linux gpasswd is a workgroup file under Linux /etc/group and /etc/gshadow is a management tool used to add a user to a group or remove a user from a group.
gpasswd [options] groupname
Optional parameters:
If there is a peter account on the system, and the account itself is not a member of the groupname group, you need to enter the password when using newgrp.
gpasswd groupname
This allows the user to temporarily join the group and after that, the files created by peter will also be groupname. So this method can temporarily allow peter to create files using other groups instead of peter's own group.
So using gpasswd groupname to set a password is to allow those who know the group password to temporarily switch to the group with groupname functions.
gpasswd -A peter users
In this way, peter is the administrator of the users group and can perform the following operations:
gpasswd -a mary users gpasswd -a allen users
NoteTo add a user to a specific group, you can use usermod -The command G group_name user_name can add a user to the specified group, but the previously added groups will be cleared.
So if you want to add a user to a group while retaining the previously added groups, please use the gpasswd command to add the operation user:
gpasswd -a user_name group_name