0

I was wondering how I could deny all SSH logins from any IP but mine? This would be using IPTables.

1
  • @Paul I honeslty didnt know where to start... I am not too fond of IPTables Mar 6, 2013 at 0:46

2 Answers 2

1

There are multiple ways to do this using iptables - From the command line:

/sbin/iptables -I INPUT -s MY.IP -p tcp --dport 22 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22 -j DROP

You can do a similar thing leaving out the /sbin/iptables, adding it near the top of /etc/sysconfig/iptables and then doing a restart.

If you want to steer clear of IPTables altogether you can simply modify the SSHD config by adding the following line to the end of /etc/ssh/ssd_config (and then restarting sshd)

AllowUsers  [email protected]

(If there is more then one user you can use the form AllowUsers [email protected] myuser2@myip [email protected] )

1

Looks like you need to configure iptables as @davidgo has mentioned. Adding:

-A RH-Firewall-1-INPUT -s 192.168.1.1 -m state --state NEW -p tcp --dport 22 -j ACCEPT

to your /sbin/iptables might work (change the ip to the desired address).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .