0% found this document useful (0 votes)
39 views2 pages

Newgrp Command

The newgrp command allows users to change their current group ID during a login session. It prompts for a group password if required. Newgrp uses system files like /etc/passwd and /etc/group to validate the group and update the user's group membership and environment. The syntax is newgrp [-] [group], where specifying a group logs the user into that group and the - option reinitializes the user environment.

Uploaded by

Darko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Newgrp Command

The newgrp command allows users to change their current group ID during a login session. It prompts for a group password if required. Newgrp uses system files like /etc/passwd and /etc/group to validate the group and update the user's group membership and environment. The syntax is newgrp [-] [group], where specifying a group logs the user into that group and the - option reinitializes the user environment.

Uploaded by

Darko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux newgrp command

Updated: 09/15/2017 by Computer Hope

• About newgrp
• newgrp syntax
• newgrp examples
• Related commands
• Linux and Unix commands help

About newgrp
The newgrp command allows a user to log in to a new group.

Description
The newgrp command is used to change the current group ID (GID) during a login session. If a hyphen
("-") is included as an argument, then the user's environment is initialized as though he or she had just
logged in; otherwise, the current working environment remains unchanged. newgrp changes the
current real group ID to the specified group, or, if no group is specified, to the default group listed in
the file /etc/passwd. newgrp also tries to add the group to the user groupset.
If the user is root, he or she will not be prompted for a password.
If the user is not root, he or she will be prompted for a group password if:
• the user does not have a password, but the group does, or if
• the user is not listed as a group member, and the group has a password.
If there is no group password set, and the user is not listed as a member of the group, the user will be
denied access.
If there is an entry for the group in the shadowed group password file, /etc/gshadow, then the list of
members and the password for this group will be taken from this file. Otherwise, the group entry in
/etc/group is used.

newgrp syntax
newgrp [-] [group]

Files
newgrp makes use of the following files:

/etc/passwd User account information.


/etc/shadow Secure user account information.
/etc/group Group account information.
/etc/gshadow Secure group account information.

newgrp examples
newgrp developers

Attempts to log in to the group developers.


newgrp - developers

Attempts to log in to the group developers, and, if successful, re-initializes the user environment.

You might also like