sudo version 1.6.7p5 : using -H -u options on Solaris 8

From: David Stapleton (nefarus@hotmail.com)
Date: Mon Dec 15 2003 - 11:26:29 EST


Hi all (again),

I must apologise as my example seems to have put the trust of the question
into one of shell expansion rules and not what I really wanted to find out,
my fault for not giving a good example.

The main trust of my question is really this, when executing the command :

$ sudo -H -u oracle env

some of the variables are lost, for example, if I su to the oracle user
there is a CLASSPATH variable set which, as the oracle user I can see by
typing `echo $CLASSPATH` or I can also see it easily if I use the "env"
command as oracle and grep out CLASSPATH.

If I use the sudo command above while logged in as user X, I would expect
the output to be the same as if I used "env" as oracle.

Although some variables are correct, for example, when I use the above
command, the "env" output correctly tells me that the SUDO_USER is "X" and
that the USER is oracle BUT it doesn't pass over all variables, such as
CLASSPATH, etc. which are set up for oracle.

I hope that this is a little clearer and apologies for the stupid example.
(original note below) and I WILL summarise.

David S.

==== original note ====

Hi all,

It's been a while since playing around with this stuff but I have an issue
with sudo not setting the $HOME variables of the target user.

For example, Assuming I am user X with a $HOME variable set to /users/X, I
want to use sudo to run an Oracle command as the user oracle, so I use the
following syntax :

$ sudo -H -u oracle echo $HOME

What, perhaps in my ignorance, I would expect to see from the above command
would be the $HOME variable of oracle, i.e. /users/oracle BUT I still see
the $HOME variable of user X, /users/X.

I thought that the -H option in sudo sets the $HOME variable to the homedir
of the target user, oracle in this example.

My issue is really around the fact that I cannot use oracle in this way
because sudo does not appear to be able to take the oracle variables such as
$ORACLE_HOME, $ORACLE_SID, etc. (again, perhaps in my ignorance).

Is there an issue with this or am I mis-reading the sudo MAN page?

If an issue, a work around would be good but a final solution would be
better.

Thanking you in advance.

David S.

P.S. I have read the archives and cannot find an exact match for this
problem other than the solution of using the -H option OR hardcoding
something in the sudoers file "defaults always_set_home", which doesn't seem
to work either.....

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:41 EDT