Operating System - HP-UX
1836369 Members
2139 Online
110100 Solutions
New Discussion

How do I prevent direct root login

 
SOLVED
Go to solution
Velmurugan
Occasional Contributor

How do I prevent direct root login

I want to disallow anybody logging in as root from other hosts/terminals. I want them to first become themselves and then su - to root, so that I can track who becomes root.
Thanks
Each of social/professional status of a person has got it own pleasure and pain.
2 REPLIES 2
Steven Sim Kok Leong
Honored Contributor
Solution

Re: How do I prevent direct root login

Hi,

# echo console > /etc/securetty

This will allow only root access via the console. You can further restrict access to the "su" command by setting an ACL (access control list) on the executable via "chacl".

Regards.

Steven Sim.
Rumen Ginev
Frequent Advisor

Re: How do I prevent direct root login

Add in /etc/profile this:

TTY=`tty`
if [ $LOGNAME = "root" -a $TTY != "/dev/console" ]
then
echo "Some message....."
exit 1
fi