Allow only specific IP to SSH to Linux server

To allow only specific IP to ssh to your linux server add the entry below into your firewall config file. Usually, the firewall config file is found in /etc/sysconfig/iptables:

-A INPUT -s x.x.x.x/x -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT

x.x.x.x = your originating ssh communcation and/or the ONLY server you want to allow to SSH to your linux system
NOTE: the /x after x.x.x.x is the subnet number. so if your subnet is; then entry above should read x.x.x.x/23

Posted on January 11, 2012, in Linux. Bookmark the permalink. Comments Off on Allow only specific IP to SSH to Linux server.

Comments are closed.


Get every new post delivered to your Inbox.

%d bloggers like this: