Linux command
newgrp 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Switch
newgrp [group_name]
Switch
newgrp - [group_name]
Reset
newgrp
Rerun last command with sudo
sudo newgrp [group_name]
说明
newgrp changes the current real group ID to the specified group and also tries to add the group to the user groupset. If a hyphen is provided, the environment is reinitialized as a login shell. Files created after running newgrp will have the new group as their group owner. If not root, the user will be prompted for a password if the user does not have a password and the group does, or if the user is not listed as a member and the group has a password. The user will be denied access if the group password is empty and the user is not listed as a member. If no group is specified, the group is changed to the default group listed in /etc/passwd.
参数
- -
- Reinitialize the environment as if the user had logged in
- group
- Group name to switch to; must be a member or know group password
FAQ
What is the newgrp command used for?
newgrp changes the current real group ID to the specified group and also tries to add the group to the user groupset. If a hyphen is provided, the environment is reinitialized as a login shell. Files created after running newgrp will have the new group as their group owner. If not root, the user will be prompted for a password if the user does not have a password and the group does, or if the user is not listed as a member and the group has a password. The user will be denied access if the group password is empty and the user is not listed as a member. If no group is specified, the group is changed to the default group listed in /etc/passwd.
How do I run a basic newgrp example?
Run `newgrp [group_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does - do in newgrp?
Reinitialize the environment as if the user had logged in