Operating System - HP-UX
1834208 Members
2655 Online
110066 Solutions
New Discussion

Re: restricting access to a generic userid

 
SOLVED
Go to solution
Philip Lunney
Occasional Advisor

restricting access to a generic userid

Hi all

I am trying to restrict access to our Oracle account but at the same time allow the userid itself to remsh between servers. I have come up with a method of allowing only listed users the ability to su to oracle and have prevented Oracle from logging on to the server directly but as a result I am running into problems running scripts as oracle between servers.

Anyone got any way around this?? Does it make sense?

Cheers Barbara
11 REPLIES 11
John Palmer
Honored Contributor

Re: restricting access to a generic userid

Hi Barbara,

What do your scripts do and what problems are you getting?

Regards,
John
Philip Lunney
Occasional Advisor

Re: restricting access to a generic userid

Hi John

We have a nightly backup menu running on one server and one of the options is to remsh over to another server as oracle and shutdown the Oracle database. We have other similar scripts.

Cheers Barbara.

John Palmer
Honored Contributor

Re: restricting access to a generic userid

Is your problem that you've prevented remsh as oracle? If so, could you not remsh as a different (listed) user and then su to oracle locally?

Regards,
John
MANOJ SRIVASTAVA
Honored Contributor
Solution

Re: restricting access to a generic userid

Hi Barbara


What we do is to restrict direct login to oracle and root . Only users can su to root and oracle . What we have done is put a small script in /etc/profile which is like this

# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH

PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man

loginid=`who am i | awk '{print $1}'`

echo $loginid
if [ $loginid = oracle ]
then
exit
fi

echo $loginid
if [ $loginid = root ]
then
exit
fi


# Insure PATH contains either /usr/bin or /sbin (if /usr/bin is not available).

so that we have a log of who logs and we just checl sulog to know who accees the account and for what time.


Manoj Srivastava

Philip Lunney
Occasional Advisor

Re: restricting access to a generic userid

Hi JOhn

within some of our scripts remshing as someone and then su-ing to oracle (or whoever) is not an option unfortunately!

Any other ideas??
Philip Lunney
Occasional Advisor

Re: restricting access to a generic userid

Hi Manoj

Does your script still allow the oracle user to remsh between servers??

Cheers Barbara
John Palmer
Honored Contributor

Re: restricting access to a generic userid

What have you done to prevent Oracle logging in and how has this prevented remsh?

Regards,
John
MANOJ SRIVASTAVA
Honored Contributor

Re: restricting access to a generic userid

Hi Barbara


Yes , as we have a complex env here and we have to do lots of remsh to get status .


Manoj Srivastava
MANOJ SRIVASTAVA
Honored Contributor

Re: restricting access to a generic userid

Hi Barbara

The process is that

1. Edit /etc/profile for just the oracle part.This will prevent anyone logging in as oracle directly.
2. DBA logs in as dba.
3. he does su - oracle.
4. then with oracle he can remsh to toher machines.


Manoj Srivastava
Philip Lunney
Occasional Advisor

Re: restricting access to a generic userid

John

Our oracle .profile looks something like this:

NAME=`who am i | awk '{print $1}'`
DT=`date "+%m/%d/%y %H:%M:%S"`
DT2=`date "+%m%d%y%H%M"`
NAMEDIR=/usr/local/bin
USERS=$NAMEDIR/users

if [ $NAME = `whoami` ]
then
sleep 2 # allow time to display message.
echo "\nYou cannot log in as user $LOGNAME, use su!\n"
exit
fi

echo "\nChecking access rights for $NAME..."
sleep 2

if grep $NAME $USERS
then
echo "\n$NAME - access allowed."
else
echo "\nYou do not have access to the `whoami` account."
echo "Bye!"
exit
fi

echo "\n##################################################################"
echo "\nSU from $NAME to `whoami` at $DT"
echo "\nWARNING - You are now logged in as `whoami` !!!"
echo "\nThis is a privileged account, all activity is logged, BE CAREFUL !"
echo "\n##################################################################"

echo "\n\n\nHit Enter to continue...\c"
read a

. ./.profile2


And because we have disabled any direct login we have disabled the remsh facility also!
John Palmer
Honored Contributor

Re: restricting access to a generic userid

Morning Barbara,

I've thought of a couple of possibilities...

1. You could change your .profile to check whether it's been called via remsh and allow it. This piece of code will check:-
CALLER=$(UNIX95= ps -p ${PPID} -o comm|tail -1)
if [[ ${CALLER} = rlogind ]];
then
fi

2. My original suggestion of remsh'ing as a different user and su'ing to oracle will still work as follows:-
Set-up the required oracle database environment and then use su (not su -) thus...
. <script to set-up env>
su oracle -c "sqlplus or svrmgrl"

Are these any help?

Regards,
John