cancel
Showing results for 
Search instead for 
Did you mean: 

problem in su

Jenny John
Advisor

problem in su

i am running a shell script in hp-ux for export of my database when i su - oracle, it is propmting for password and im running the script from oracle user itself
2 REPLIES
Fayez
Trusted Contributor

Re: problem in su

Hi,

This is Linux area, any way it is normal to ask because you are not root user, to work around, try to run it as root user, make the script some thing like this:

export ORACLE_HOME=
export PATH=$PATH:$ORACLE_HOME
su - oracle -c ""

hope it will help
Matti_Kurkela
Honored Contributor

Re: problem in su

Or make your script use su only when necessary, with a test like this:

if [ $(whoami) != "oracle" ]; then
SUPREFIX="su - oracle"
else
SUPREFIX=""
fi

# prefix the command with "su - oracle" if run as someone other than "oracle"
$SUPREFIX somecommand

MK
MK