Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

newgrp(1) [suse man page]

newgrp(1)						      General Commands Manual							 newgrp(1)

NAME
newgrp - change effective group ID sg - execute command with different group ID SYNOPSIS
newgrp [-l] [group] sg group -c command DESCRIPTION
The newgrp command changes the user's real and effetive group ID by replacing the current shell with a new shell. A new shell is launched even if an error occours. A password is requested if the group has a password and the user is not listed in the group file as being a member of that group. The pass- word can be changed with the gpasswd(1) command. If the new effective group ID is not in the supplementary group list, newgrp will add the new group ID to the supplementary list, too. With no operands and options, newgrp changes the user's group IDs (real and effective) back to the group specified in password and group file. The sg command works like the newgrp command, except that it executes the given command with /bin/sh and upon exit the group ID of the cur- rent shell is not changed. OPTIONS
-l, --login reinitialize the environment as if the user logged in. --help Print a help list. -u, --usage Print a short usage message. -v, --version Print program version. SEE ALSO
gpasswd(1), group(5), passwd(1), passwd(5), su(1) AUTHOR
Thorsten Kukuk <kukuk@suse.de> pwdutils April 2004 newgrp(1)

Check Out this Related Man Page

NEWGRP(1)						    BSD General Commands Manual 						 NEWGRP(1)

NAME
newgrp -- change to a new group SYNOPSIS
newgrp [-l] [group] DESCRIPTION
The newgrp utility creates a new shell execution environment with modified real and effective group IDs. The options are as follows: -l Simulate a full login. The environment and umask are set to what would be expected if the user actually logged in again. If the group operand is present, a new shell is started with the specified effective and real group IDs. The user will be prompted for a password if they are not a member of the specified group. Otherwise, the real, effective and supplementary group IDs are restored to those from the current user's password database entry. EXIT STATUS
The newgrp utility attempts to start the shell regardless of whether group IDs were successfully changed. If an error occurs and the shell cannot be started, newgrp exits >0. Otherwise, the exit status of newgrp is the exit status of the shell. SEE ALSO
csh(1), groups(1), login(1), sh(1), su(1), umask(1), group(5), passwd(5), environ(7) STANDARDS
The newgrp utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A newgrp utility appeared in Version 6 AT&T UNIX. BUGS
Group passwords are inherently insecure as there is no way to stop users obtaining the crypted passwords from the group database. Their use is discouraged. BSD
May 23, 2002 BSD
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print out a selected word.

Hi can anyone assist me on my problem. I try to grep 1 word in 1 line data. Example like below. * Data below located in a.txt, i just wanna grep just processing-time = "12" total-octets = "20080718214210Z" total-pages = "" octets-completed = "20080721064351Z" pages-completed = "2"... (10 Replies)
Discussion started by: anakiar
10 Replies

2. Shell Programming and Scripting

How to tweak up

I have a script like this: while read abbrev; do sed 's/'$(echo "$abbrev" | tr "" "")'/'"$abbrev"'/g' 'output_rgt.'$$ >'tmp.'$$ mv 'tmp.'$$ 'output_rgt.'$$ done<'dict.shortcuts.'$$ And I don't know how to leave "mv" out. ('dict.shortcuts.'$$ may be... (14 Replies)
Discussion started by: MartyIX
14 Replies

3. Shell Programming and Scripting

Users Not Logged in

I have searched the forums but have not mangaed to quite find what im looking for. I have used to /etc/passwd command to present me a list of all users the who command to present all users currently logged on, but what i want to know is what command can i use to display users that are registered... (12 Replies)
Discussion started by: warlock129
12 Replies

4. Shell Programming and Scripting

command to group records

hi, i have records like this supplier,product, persons involved 10,150,ravi@yahoo.com 30,200,ravi@yahoo.com 20,111,payal@gmail.com 40,211,ravi@yahoo.com i want to write a command which displays values like this 10,30,40,ravi@yahoo.com for ravi@yahoo.com if there are n number of... (7 Replies)
Discussion started by: trichyselva
7 Replies

5. Shell Programming and Scripting

Split file by data group

Hi all, I'm having a little trouble solving a file split I need to get done. I have the following data: 1. Light 1A. Light Soft texture: it's soft color: the color value is that of something light vital statistics: srm: 23 og: 1.035 sp: 1.065 comment: this is nice if you like... (8 Replies)
Discussion started by: mkastin
8 Replies

6. Shell Programming and Scripting

Print pattern

Hi all! I have a large file and want to print 4 pattern + 2 lines after each of the pattern after each pattern, the lines are not the same sed to print a pattern sed -n '/pattern1/{N;N;N;p;}' pattern1 ......... ........ pattern2 .......... ......... pattern3 ............. (7 Replies)
Discussion started by: Novice-
7 Replies

7. Shell Programming and Scripting

Sort the file contents in each group....print the group title as well

I've this file and need to sort the data in each group File would look like this ... cat file1.txt Reason : ABC 12345-0023 32123-5400 32442-5333 Reason : DEF 42523-3453 23345-3311 Reason : HIJ 454553-0001 I would like to sort each group on the last 4 fileds and print them... (11 Replies)
Discussion started by: prash184u
11 Replies

8. Shell Programming and Scripting

matching group of words

Hi, I am stuck with a problem, will be thankful for your guidance and help. I have two files. Each line is a group of words with first word as group Id. eg. 'gp1' in File1 and 'grp1' in File2. <File1> gp1 : xyz xys3 syt2 ssx itt kty gp2 : syt2 kgk iti op2 gp3 : ppy yt5 itt sky... (11 Replies)
Discussion started by: mira
11 Replies

9. Shell Programming and Scripting

need a one liner to grep a group info from /etc/group and use that result to search passwd file

/etc/group tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root /etc/passwd mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies

10. Shell Programming and Scripting

How to pick a group of data using awk/ksh

Hi gurus, I have data coming in as shown below. And in each case, I need to pick the data in the last group as shown below. Data Set 1: DC | 18161621 LA | 15730880 NY | 16143237 DC | 18161621 LA | 17316397 NY | 17915905 DC | 18161621 LA | 17993534 NY | 18161621 DC | 18161621... (11 Replies)
Discussion started by: calredd
11 Replies

11. Shell Programming and Scripting

Get group of consecutive uppercase words using gawk

Hi I'd like to extract, from a text file, the strings starting with "The Thing" and only composed of words with a capital first letter and apostrophes, like for example: "The Thing I Only" from "those are the The Thing I Only go for whatever." or "The Thing That Are Like Men's Eyewear" ... (7 Replies)
Discussion started by: louisJ
7 Replies

12. Shell Programming and Scripting

Sed command help (appending)

I need to append a user to the end of a group in the /etc/group file ftp::49:user1,user2... what I want to to add a new user to the group file so that I won't have to open it up and append manually and I can't user "usermod" it fails this user will be coming from a variable (11 Replies)
Discussion started by: slufoot80
11 Replies

13. UNIX for Dummies Questions & Answers

Restrict a user from Executing particular command

hi how to restrict a user ro run rm command. In this scenario we have a user/group has below in sudoers user ALL=(ALL) ALLis there a way to restrict the user from just executing rm command (9 Replies)
Discussion started by: robo
9 Replies

14. Shell Programming and Scripting

Emulate group-by in shell script

Hello All, I saw this problem on one of the forum and solved it using group-by in oracle sql, though I am a bit curious to implement it using shell script : There is a file having number of operations : Opeation,Time-Taken operation1,83621 operation2,72321 operation3,13288... (11 Replies)
Discussion started by: mukulverma2408
11 Replies

15. Shell Programming and Scripting

How to generate all combinations of group lists at the same time?

Hi, everyone I have a group lists like this (more lines are omitted: a b c d E F G H .... I want to generate all combinations of two elements in each group line. What I expected is this: a b a c a d b c b d c d E F E G E H F G F H G H (8 Replies)
Discussion started by: nengcheng
8 Replies