How do I limit remote access to the server via ssh. My server is getting hit with a lot of attempts to logon via ssh. I would like to limit ssh to 5 or 6 ip address ranges that I and the a couple of other admins use.
Looking around for other examples it looks like this might work, as root do the following?
# mkdir -p /etc/e-smith/templates-custom/etc/host.allow
# echo " sshd: 127.0.0.1 10.0.0.0/255.255.255.0 xxx.xxx.xxx.0/255.255.255.0 yyy.yyy.yyy.0/255.255.255.0 \
zzz.zzz.zzz.0/255.255.255.0" > /etc/e-smith/templates-custom/etc/host.allow/sshd
[10.0.0.0 is the local network ip and the others are the ip ranges I want to accept login via ssh from]
# /sbin/e-smith/expand-template /etc/host.allow
Is this the proper way to do this?
Thanks
RedBeard
It might be if you change 'host.allow' to 'hosts.allow' in your code.
When I tried to use htis approach, however, I ran into a problem - quite possibly of my own making. I used the line...
echo " sshd: 127.0.0.1 192.168.10.0/255.255.255.0 xxx.xxx.xxx.0/255.255.255.255">/etc/e-smith/templates-custom/etc/host.allow/sshd
Where xxx.xxx.xxx.xxx is a specific, single fixed IP address that I wish to allow access via ssh, and 255.255.255.255 is the netmask needed to speccify a single address.
When I expanded the template the correct entry as made to /etc/hosts.allow, but all SSH entry is now blocked on the server.
What did I do wrong?
Ed Form