Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

newgrp(1) [v7 man page]

NEWGRP(1)						      General Commands Manual							 NEWGRP(1)

NAME
newgrp - log in to a new group SYNOPSIS
newgrp group DESCRIPTION
Newgrp changes the group identification of its caller, analogously to login(1). The same person remains logged in, and the current direc- tory is unchanged, but calculations of access permissions to files are performed with respect to the new group ID. A password is demanded if the group has a password and the user himself does not. When most users log in, they are members of the group named `other.' Newgrp is known to the shell, which executes it directly without a fork. FILES
/etc/group, /etc/passwd SEE ALSO
login(1), group(5) NEWGRP(1)

Check Out this Related Man Page

NEWGRP(1)                                                          User Commands                                                         NEWGRP(1)

NAME
newgrp - log in to a new group SYNOPSIS
newgrp [-] [group] DESCRIPTION
The newgrp command is used to change the current group ID during a login session. If the optional - flag is given, the user's environment will be reinitialized as though the user had logged in, otherwise the current environment, including current working directory, remains unchanged. newgrp changes the current real group ID to the named group, or to the default group listed in /etc/passwd if no group name is given. newgrp also tries to add the group to the user groupset. If not root, the user will be prompted for a password if she does not have a password (in /etc/shadow if this user has an entry in the shadowed password file, or in /etc/passwd otherwise) 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 there is an entry for this group in /etc/gshadow, then the list of members and the password of this group will be taken from this file, otherwise, the entry in /etc/group is considered. CONFIGURATION
The following configuration variables in /etc/login.defs change the behavior of this tool: SYSLOG_SG_ENAB (boolean) Enable "syslog" logging of sg activity. FILES
/etc/passwd User account information. /etc/shadow Secure user account information. /etc/group Group account information. /etc/gshadow Secure group account information. SEE ALSO
id(1), login(1), su(1), sg(1), gpasswd(1), group(5), gshadow(5). shadow-utils 4.5 01/25/2018 NEWGRP(1)
Man Page

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

newgrp command

I'd like to make an alias of commands which contains the command newgrp. exple: alias my_cmde newgrp toto; my_pg & this line doesn't work. why ? Thanks for your help (2 Replies)
Discussion started by: Nathe
2 Replies

2. UNIX for Dummies Questions & Answers

newgrp in a script

I want to do these commands in a script: if the user name is 'toto' then the user switch to the group toto_group and then 2 others scripts are launched. Unfortunately, after the command 'newgrp' the 2 scripts are not launched correctly. But if I do the same, by hand, one line per one line, it... (11 Replies)
Discussion started by: Nathe
11 Replies

3. Shell Programming and Scripting

Automating 'newgrp' command - how?

Hi, I have to add the 'newgrp' command to my login (.cshrc) script. The problem is that if I add it, it comes to infinite look, since newgrp opens new shell again and again. How to automate the newgrp when I have to login, and avoid that loop? Currently I'm thinking of a condition that... (2 Replies)
Discussion started by: moshmosh
2 Replies

4. Shell Programming and Scripting

what is the right way to use newgrp in script

my requirement is $ id user o/p for the above command $ uid=1(user) gid=2(x) a user is involved in 3 groups x,y,z whenever the user try to execute a script, script should ask for the group as input from user ,assume the group he wants to change as Y and the rest of the... (3 Replies)
Discussion started by: ram_unx
3 Replies

5. Shell Programming and Scripting

How to use newgrp or sg in user mode without password prompt?

Hi, Is it possible to call newgrp or sg from user mode without password prompt in a Linux script? Thank you. hce (2 Replies)
Discussion started by: hce
2 Replies

6. Shell Programming and Scripting

How to set up newgrp on .profile?

Hello all, I am having an issue setting up an environment on .profile. I want to set up my .profile in that way that everytime I login to the host, it should automatically set up my group. I tried the folllowing but it doesn't work. It is on the solaris OS. HOSTNAME=$(hostname) if ] || ]... (14 Replies)
Discussion started by: Pateltiger
14 Replies

7. Solaris

Newgrp fails on only 1 group

I have a handful of users who can't 'newgrp' to one specific group from Solaris 9 and 10 nodes and always get this prompt: newgrp: Password: We never get prompted by 20+ other groups and this group never prompts for a password from Red Hat Linux nodes. Authentication comes from AD and there's... (4 Replies)
Discussion started by: rnae20
4 Replies