Subject: Re: "Don't login as root, use the su command."
To: Andrew Brown <atatat@atatdot.net>
From: David Brownlee <abs@netbsd.org>
List: current-users
Date: 02/17/2000 12:12:12
On Wed, 16 Feb 2000, Andrew Brown wrote:

> >	That would also work fine...
> >	The SU_FROM avoids anything on /usr in root's dotfiles, and the
> >	(insignificant) overhead of running an extra process.
> 
> um....heh.  if you can't use logname, you can't use su.  su's is
> /usr/bin as well, ya know.  :)
> 
	Indeed - but the .login file can be executed without /usr
	mounted when csh is started in single user mode.

	That can be fixed by using:

	if ( -x /usr/bin/logname ) then
		if (`logname` == root ) echo message
	endif

> >	There is not much to choose between them, but I'm inclined to
> >	stick with SU_FROM because its already there :)
> 
> well...only because it was recently put there, no?  besides, wouldn't
> using logname be much more incredibly portable?  isn't portability a
> good thing?

	What should happen in the (albeit interesting :) case of:

		login as root (get message)
		su user
		su root (should you get the message?)

	I think SU_FROM has slightly better semantics (account is an
	'su') rather than logname (initial login on this terminal),
	but I'm probably biased as I introduced it :)

		David/absolute