If anyone can help me or point me in the right direction I would appreciate it.
:I am trying to write a menu for my users. I need to be able to use the newgrp command to switch them to the appopriate group.
:When I issue a newgrp command under hp-ux 9.04 the command forks a new shell and my script stops. If I type in "exit" and press
:enter then the script continues. From what I have read I don't think the newgrp command should be doing this.
:If anyone can help me or point me in the right direction I would appreciate it.
Per the man page, that is what it does. If your intention is to make
it so a person can have group access to files belonging to different
group, then type
ln -s /etc/group /etc/logingroup
The users will automatically be members of all groups (up to 20) in
which they are listed in the group file. The reason for the symbolic
(rather than hard) link is that renaming and recreating the group file
would otherwise destroy the link and some things at 9.X do exactly
that.
Alternately /etc/logingroup can be an independent file but that means
you must maintain 2 group files.
--
jo...@atl.com
HP North American Escalation Center
I am currently using the /etc/group -> /etc/logingroup method for access and secrutiy purposes.
My problem is that a user logs in and their primary group in their /etc/passwd is XXXXX and they chose application YYYY
from my menu, when using this application they create files that belong to group XXXX and they should belong to YYYY.
This is why I need to switch their primary group with the newgrp command from within a script.
I currently have the following mystery.
When I login and type "ps" I have 1 shell. then I type "/bin/newgrp" then type "ps" and I have 2 shells.
When I login and type "newgrp" without the absolute path then type ps I have only 1 shell.
What is the difference in typing /bin/newgrp and just newgrp.
Thanks in advance for any help you can share.
Steve Roeder
>Per the man page, that is what it does. If your intention is to make
>it so a person can have group access to files belonging to different
>group, then type > ln -s /etc/group /etc/logingroup
Well, I confess I don't much read man-pages too often :) so I never
came across this /etc/logingroup thing before.
Is there a way to tie in the /etc/logingroup to the NIS-based-group list?
My primary group is "cs". Fine. And in the YP-database on my Sun-NIS
server (using NIS on SunOS 413), I also have a /var/yp/group file, whih
lists acs:my_uid, thus putting me also in the "acs" group as well.
Under SunOS, I automagically am in both groups all the time.
I guess, from reading the manpage for logingroup, that I could make a sym-link
or some such to the groups file, but it doesn't say if I can the equivalent
of + in a logingroup file.
If anyone has any tips on setting up the logingroup (or whatever other
mechanism) that would allow a user to be "in all groups he should be in"
all "at the same time" without having to newgrp, via NIS, I'd appreciate
you dropping me a note.
Thanks all,
PH
--
Paul Hirose : pthi...@ucdavis.edu : I don't speak for UC Davis, or
Engr: ACS : Programmer/Analyst : ACS unless specified otherwise
1039 Academic Surge : -----------------------------------------------------
Davis, CA 95616-8770 : SysAdmin Motto - "/usr/bin/mv /my/life /dev/null"
The difference is that newgrp is a shell-builtin when you just type newgrp,
but if you give the explicit path you're getting the command version which
has to spawn a new process. This doesn't appear to be a builtin you can access
from a script.
As an alternative to your problem, if your users create their files for the
application(s) in question in a specific directory, you can set the setgid bit
on that directory and make the owner the group you want to own the files in
that directory. Note:
# mkdir /tmp/dir
# ls -ld /tmp/dir
drwx------ 2 root sys 24 Sep 25 15:22 /tmp/dir
# touch /tmp/dir/test1
# ls -l /tmp/dir
total 0
-rw------- 1 root sys 0 Sep 25 15:22 test1
# chmod g+s /tmp/dir
# chgrp mail /tmp/dir
# ls -ld /tmp/dir
drwx--S--- 2 root mail 1024 Sep 25 15:22 /tmp/dir
# touch /tmp/dir/test2
# ls -l /tmp/dir
total 0
-rw------- 1 root sys 0 Sep 25 15:22 test1
-rw------- 1 root mail 0 Sep 25 15:22 test2
#
--
Doug Siebert || "Usenet is essentially Letters to the Editor
University of Iowa || without the editor. Editors don't appreciate
dsie...@icaen.uiowa.edu || this, for some reason." -- Larry Wall
(c) 1995 Doug Siebert. Redistribution via the Microsoft Network is prohibited.
: >Per the man page, that is what it does. If your intention is to make
: >it so a person can have group access to files belonging to different
: >group, then type > ln -s /etc/group /etc/logingroup
: Well, I confess I don't much read man-pages too often :) so I never
: came across this /etc/logingroup thing before.
Try reading this one - all the info you need is there.
Basically, just link /etc/logingroup to /etc/group and everything works
"automagically" as you put it, including NIS
--
Alan Massey, Computer Systems Manager, Philips Semiconductors, Southampton, UK
email : mas...@ukpsshp1.serigate.philips.nl (SERI : massey@ukpsshp1)
Tel : +44 (0)1703 316450 Fax : +44 (0)1703 316305
Your problem: user default in group xx wants to run an application in
group yy from the menu.
In the past I had the same problem and wrote a script called `execgrp`
------------------------------------------------start of execgrp
#!/bin/sh
if [ $# -eq 0 ]
then
echo "`basename $0`: Execute program with given group"
echo "usage: `basename $0` group executable [options...]"
echo " umask is set to 007 for all commands"
echo " This is overruled by your private settings"
echo ""
echo "NOTE: This is only for processes that can run in the background"
echo " use newgrp for interactive or shell usage"
exit
fi
GROUP=$1
shift
/bin/newgrp $GROUP << EndOfGroup
umask 007
$* &
EndOfGroup
--------------------------------------------------end of execgrp
It sets the umask to 007 to overrule the user's umask but an
umask setting in the user's .cshrc file overrules this once again.
At our site, the user set's his/her own umask in the .login.
Groetjes
Corne
--
This is MY opinion, not the opinion of my boss nor the company!
C.J.P. Beerse | Alcatel Telecom Systems
beerse%nls...@btmv.bel.alcatel.be | Postbus 3292
Tel:(+31)70 3079108 Fax:(+31)70 3079191 | NL-2280 GG Rijswijk