- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- newgrp in a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 09:26 AM
тАО01-22-2003 09:26 AM
newgrp in a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 09:51 AM
тАО01-22-2003 09:51 AM
Re: newgrp in a script
HTH
DUncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 10:02 AM
тАО01-22-2003 10:02 AM
Re: newgrp in a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 10:19 AM
тАО01-22-2003 10:19 AM
Re: newgrp in a script
I think you see my problem better now :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 10:42 AM
тАО01-22-2003 10:42 AM
Re: newgrp in a script
It's written in ANSI C so compile it like this:
cc -Ae suexec.c -o suexec
chown root suexec
chmod 4755 suexec
If you don't have a development compiler then you can convert it to K&R C and use the bundled compiler.
Use it like this:
suexec -g mygroup tom /usr/bin/sh
That will start a new shell with user 'tom' group 'mygroup'.
suexec with no args will display usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2003 11:52 AM
тАО01-22-2003 11:52 AM
Re: newgrp in a script
usually the reason for using "newgrp" is to make newly created files to belong to that group.
You can achieve that in other ways: if those file are to reside in the same directory, set the SGID bit on the directory itself (a BSD tradition) and "chgrp" that directory to the group wanted.
FWIW,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2003 02:26 AM
тАО01-23-2003 02:26 AM
Re: newgrp in a script
In my case, an application must be able to execute or write in other application. Each aplication had his own group.
If I use your C program in a script, I must execute suexec each time the script execute or write in other application.
Ex:
#!/bin/ksh
suexec -g newgroup user proc1
suexec -g newgroup user proc2
suexec -g newgroup user proc3
Now is it possible to write a C prog which change the id group for all the command in the scripts so I can call this prog only one time at the beginning of the scripts.
Ex:
#!/bin/ksh
suexec -g newgroup
proc1
proc2
proc3I am afraid that is not possible because all the C functions I know modify the gid for the current process only. So the new groupw will not valid after the suexec execution. I couldn't use newgrp because as I already said, newgrp call a new shell so in this exemple proc1, proc2 and proc3 will be never executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2003 05:26 AM
тАО01-23-2003 05:26 AM
Re: newgrp in a script
ln -s /etc/group /etc/logingroup
Note that this provides membership privileges and will not change the default group like newgrp.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2003 06:18 AM
тАО01-23-2003 06:18 AM
Re: newgrp in a script
On HPUX, the max number of simultaneous supplementary group IDs per process (NGROUPS_MAX) is 20. In my case, I could have more than 20 groups. /etc/logingroup is only valid for 20 groups. So if you declare one user with 21 groups, command id shows you 20 groups not 21 and you don't have any right on the last group. But you can use newgrp to acces this new group. It's why I would want a binary doing the same thing like newgrp except openning a new shell!