1825793 Members
2338 Online
109687 Solutions
New Discussion

ssh no root login

 
SOLVED
Go to solution
Jannik
Honored Contributor

ssh no root login

I what my machine to have no root login, that is easy (in sshd_config):
PermitRootLogin no

BUT i what to be able to do root login from one host. how is that possible?
jaton
2 REPLIES 2
RAC_1
Honored Contributor
Solution

Re: ssh no root login

Enable ssh root login on server. Run ssh as service through inetd.conf.

Put some code in /etc/profile to allow ssh login only through particular host(ip address) Something like follows.

ip="xx.xx.xx.xx"

ip1=`who -u|grep root|awk '{print $NF}"`

if [ ${ip} -eq ${ip1} ]
then
echo "ssh root login from ${ip}
else
echo "ssh root login only from ${ip}
exit 0
fi

Anil
There is no substitute to HARDWORK
Jannik
Honored Contributor

Re: ssh no root login

who -um
tnx :-)
jaton