1846875 Members
5794 Online
110256 Solutions
New Discussion

Direct root access

 
SOLVED
Go to solution
Prashant_15
Occasional Contributor

Direct root access

How to restrict direct root access on HP-UX?

Please reply

Thanks and regards
Prashant
9 REPLIES 9
Ken Penland_1
Trusted Contributor
Solution

Re: Direct root access

vi /etc/securetty and put the word console in it by itself, this will prevent root from logging in from anywhere but the console...you can still su to root however.
'
Jeff Schussele
Honored Contributor

Re: Direct root access

Hi Prashant,

Do the following:

echo console > /etc/securetty
chown root:sys /etc/securetty
chmod 400 /etc/securetty

Now the only place that root can login from directly is the console.
If the file already exists, insure it only contains the string console

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Pramod_4
Trusted Contributor

Re: Direct root access

1) Enable /etc/securetty to restrict root to console.
2) Use sudo to avoid direct use of root account.

Pramod
Patrick Wallek
Honored Contributor

Re: Direct root access

Prashant_15
Occasional Contributor

Re: Direct root access

Cheers,

Many thanks..

MANOJ SRIVASTAVA
Honored Contributor

Re: Direct root access

Prashant

You can also do the following

edit /etc/profile and add the following lines

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

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


this will exit the direct root login , however a user can login as a user and then su to root .


Manoj Srivastava
Bill Hassell
Honored Contributor

Re: Direct root access

Easy: change the root password and never give it out to anyone. A bit more useful: download sudo and specify the commands and parameters allowed for certain users. They will never be allowed to login as root but can perform certain restricted tasks on behalf of root.


Bill Hassell, sysadmin
Wilfredo R. Castro
Occasional Advisor

Re: Direct root access

How to download the SUDO and what it does exactly?
Willie Castro
Bill Hassell
Honored Contributor

Re: Direct root access

The best source for HP-UX programs is found at http://hpux.connect.org.uk/ which is the Liverpool archive (there are several mirrors around the world). Essentially, you define user access in a file called sudoers which can be extensively configured for simple or complex commands and parameters. You can configure it so that the user simply types sudo in front of each command that requires root access. sudo logs everything so you can see the commands that were run. Knowledge of the root password is not needed.


Bill Hassell, sysadmin