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

From: David Stapleton (nefarus_at_hotmail.com)
Date: 12/15/03

  • Next message: Chris Cameron: "Monitoring real and swap mem use per process"
    To: sunmanagers@sunmanagers.org
    Date: Mon, 15 Dec 2003 16:26:29 +0000
    
    

    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


  • Next message: Chris Cameron: "Monitoring real and swap mem use per process"

    Relevant Pages

    • sudo version 1.6.7p5 : using -H -u options on Solaris 8
      ... with sudo not setting the $HOME variables of the target user. ... want to use sudo to run an Oracle command as the user oracle, ...
      (SunManagers)
    • SUMMARY: sudo version 1.6.7p5 : using -H -u options on Solaris 8
      ... Many thanks to those that responded, as expected all responses were helpful. ... This will allow you to do the thing that the user oracle requires while also ... designated in the sudoers file who requires to use the command, ... there is a CLASSPATH variable set which, as the oracle user I can see by ...
      (SunManagers)
    • Re: Basic question | run multiple queries without reconnecting
      ... :>From an oracle client like oracle sqldeveloper, I can run the DCL - ... : system as role: sysdba - but then I cant even connect to the db.. ... as default - I get the same error when I run this command: ...
      (comp.databases.oracle.server)
    • Re: How many names and addresses can you have for ID card
      ... Think command line only (except when you're installing, ... which is unsettling to we Linux users. ... This is NOTHING to do with Oracle though. ...
      (uk.legal)
    • Re: AIX Performance issue
      ... however approx 30 users normally access AIX server ... > through oracle application, every thing was running fine during last 3 ... > sar and lpstat command and their output was as given below. ... > Mostly when error occurred our database daily backup was in process ...
      (comp.unix.aix)