[comp.sys.sgi] SGI 'su'

madd@adt.UUCP (jim frost) (03/15/89)

I would appreciate it very, very much if someone would fix 'su' so it
properly reads the destination user's shell configuration files.  I'm
about to hack one together but I really shouldn't have to do that.

This is very important to me since our root .cshrc properly sets the
prompt to the hash mark, but this is never called when su'ing.  If you
forget, or if someone walks up, you or they will unknowingly be root.
This is of course very dangerous even if security isn't an issue.

jim frost
associative design technology
madd@bu-it.bu.edu

msc@ramoth.SGI.COM (Mark Callow) (03/15/89)

In article <8903141821.AA07266@adt.uucp>, madd@adt.UUCP (jim frost) writes:
> I would appreciate it very, very much if someone would fix 'su' so it
> properly reads the destination user's shell configuration files.  I'm
> about to hack one together but I really shouldn't have to do that.
> 
> This is very important to me since our root .cshrc properly sets the
> prompt to the hash mark, but this is never called when su'ing.  If you
> forget, or if someone walks up, you or they will unknowingly be root.
> This is of course very dangerous even if security isn't an issue.

Here's how I deal with that problem in my .cshrc without changing su.
I ran into this when I first started working at SGI.  As far as I recall
the problem isn't with su but with the way System V handles the "effective
user" compared with BSD.

if ($?prompt) then
	if ("$prompt" == "# ") then
		set prompt = `hostname`'#\! '
set path=(/usr/local/bin /usr/bsd /bin /etc /usr/etc /usr/bin /usr/sbin /usr/hosts /usr/games /usr/NeWS/bin /usr/demos/bin)
		umask 22
	else
		set prompt = `hostname`'{\!} '
	endif
endif
--
	-Mark

archer@elysium.SGI.COM (Archer Sully) (03/16/89)

In article <8903141821.AA07266@adt.uucp>, madd@adt.UUCP (jim frost) writes:
> I would appreciate it very, very much if someone would fix 'su' so it
> properly reads the destination user's shell configuration files.  I'm
> about to hack one together but I really shouldn't have to do that.
> 
> This is very important to me since our root .cshrc properly sets the
> prompt to the hash mark, but this is never called when su'ing.  If you
> forget, or if someone walks up, you or they will unknowingly be root.
> This is of course very dangerous even if security isn't an issue.

This is normal, proper System V behavior for su.  If you use 'su -', then
the full login procedure is followed.  If you don't wish to use su - for 
whatever reason, you can have your own .cshrc check your uid, and set
the prompt to a # when you are root.

archer
--

rpaul@dasys1.UUCP (Rod Paul) (03/16/89)

I've never had any problem with "su" regarding the correct prompts, my
systems all pretty much use the distributed .cshrc's .login's .profile's etc
The only problems I have is using 'newgrp' if my shell is csh and I try to
re-log in with the new group id.