This is the quickest way to limit the number of connection to your SSH server with iptables.
[bash]
sudo /sbin/iptables -A INPUT -p tcp –syn –dport 22 -m connlimit –connlimit-above 5 -j REJECT
[/bash]
This will only allow up to 5 concurrent connections to the SSH server, subsequent connections will be rejected by iptables, thus this can thwarts Brute-force attempts to your server.
More Articles About Securing SSH Server
While running the above command am getting the following error
/sbin/iptables -A INPUT -p tcp –syn –dport 22 -m connlimit –connlimit-above 8 -j REJECT
iptables: Unknown error 18446744073709551615
Am using Amazon AWS EC2 virtual machine, please let me know how i can fix this issue
Not for Archlinux users: http://www.archlinux.org/news/dropping-tcp_wrappers-support/
You can also use tcpwrapper to control the connection to the service.