Need to use newgrp or equivalent

Peter da Silva peter at ficc.uu.net
Sat Nov 5 08:10:13 AEST 1988


In article <1843 at cbnews.ATT.COM>, lml at cbnews.ATT.COM (L. Mark Larsen) writes:
> Assuming you are using the standard /bin/sh, turning on the setuid bit
> of /bin/newgrp is unlikely to have any impact since the newgrp command
> is a built-in command (also built-in in ksh).

If you stop to think about this, you'll see that newgrp can't be a builtin
in the shell, unless your shell runs setuid root. What is builtin is a
command to exec newgrp (instead of forking and execcing). This, in fact,
turns out to be fairly poor behaviour. Here we use a command that works
like 'su' instead of like 'login', letting you pop back to your old
group id (and environment) when you're done. Implementation is an excersize
left to the reader...
-- 
Peter da Silva  `-_-'  Ferranti International Controls Corporation
"Have you hugged  U  your wolf today?"     uunet.uu.net!ficc!peter
Disclaimer: My typos are my own damn business.   peter at ficc.uu.net



More information about the Comp.unix.wizards mailing list