Subject: Re: su -d ?
To: Ignatios Souvatzis <is@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 04/27/2003 20:08:18
> > > dsl@ suggested a -d option for the su command, that could behave as
> > > -l but leaving the new shell in the same directory where su was
> > > called (i.e., avoid switching to user's home directory).
> > 
> > What problem does this solve?
> 
> Home directory of that user inaccessible at the moment?

I was actually thinking of the case where you need to su to root,
but are deep within a directory hierachy and don't want to change
the current directory.

Using 'su root' is dangerous because it keeps all the baggage of the
existing user - if ENV is set it will run that script as root (which
is almost certainly not what you had in mind, never mind problems with
some malicious user typing export ENV=xxx while you aren't looking).

NetBSD's 'facility' of only allowing users in group wheel to run su
may stop some of the biggest problems, but you should really use
'su - root'...

	David

-- 
David Laight: david@l8s.co.uk