- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- focring users to su to a specific ID
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2002 12:40 PM
09-09-2002 12:40 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2002 01:14 PM
09-09-2002 01:14 PM
Solutionthis is how we do it for root and oracle :
loginid=`who am i | awk '{print $1}'`
echo $loginid
if [ $loginid = oracle ]
then
exit
fi
echo $loginid
if [ $loginid = root ]
then
exit
fi
These lines are to be added in /etc/profile
You can change the id to whatever you want to restrict , then the suer will ahve to su to the the id .
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2002 01:33 PM
09-09-2002 01:33 PM
Re: focring users to su to a specific ID
You could even put a password on developer by putting the encrypted password into field 2 of /etc/group. Then all the developers would have to know that password.
This way they can keep their UID number for their terminal session. Using "su", all users would have the same UID.
My 2 cents...
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2002 01:52 PM
09-09-2002 01:52 PM
Re: focring users to su to a specific ID
You can prevent direct login of all users (or primary groups) listed in a special text file by testing the ownership of the assigned tty during login by adding either of these to /etc/profile.
# If you are a restricted user and you own
# the assigned tty, then die.
if grep -Fq $(id -un) /etc/nodirectlogin
then
if [ -O $(tty) ]
then
echo 'Direct login denied.'
exit 1
fi
fi
or
# If you are a member of a restricted group
# and you own the assigned tty, then die.
if grep -Fq $(id -gn) /etc/nodirectlogin
then
if [ -O $(tty) ]
then
echo 'Direct login denied.'
exit 1
fi
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2002 11:24 PM
09-09-2002 11:24 PM
Re: focring users to su to a specific ID
for a user called flipflop, you could prevent direct logon by adding this to flipflop's .profile:
if [ `logname` = flipflop ]
then
echo Direct login not allowed for user flipflop
exit
fi
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2002 12:05 PM
09-17-2002 12:05 PM
Re: focring users to su to a specific ID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 06:57 AM
09-23-2002 06:57 AM
Re: focring users to su to a specific ID
Being out of programming for a while (C++), I had to review some things. But Shell programming is rather simple yet I cannot figure this out. Your two suggestion to put in the /home/userid/.profile does not work. The error I get is:
${HOME:-.}/.profile[28]: [userid=userid]: not found
It looks like its a parameter passing error or something like that. The error of userid=userid seem to not comparing correctly.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 07:16 AM
09-23-2002 07:16 AM
Re: focring users to su to a specific ID
Use following to restrict direct login as well as allow only authorized developers (Listed in /etc/oracle.allow file) to "su" to oracle.
####
user=`logname`;
sulog="/var/adm/sulog"
TTY="`tty | cut -d/ -f3`"
date=`date "+%m/%d %H:%M"`
if [ ${user} = "oracle" ]
then
echo "
echo "ERR ${date} - ${TTY} ${user}-oracle" >> ${sulog}
exit
fi
else
grep ${user} /etc/oracle.allow > /dev/null 2>&1
if [ ${?} -ne 0 ]
then
echo "
echo "ERR ${date} - ${TTY} ${user}-oracle" >> ${sulog}
exit
fi
fi
#--
Thanks.
Prashant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 07:18 AM
09-23-2002 07:18 AM
Re: focring users to su to a specific ID
This is to be put in /etc/profile and not in $HOME/USER/.profile
so that it runs for all users.
Manoj Srivastava