Limiting the number of connections to SSH Server using Iptables
Posted by Mohammad Hafiz mypapit Ismail on 24 Jul 2011 in Computers, GNU/Linux, security, Server, Ubuntu/Debian
|
|
This is the quickest way to limit the number of connection to your SSH server with iptables.
sudo /sbin/iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 5 -j REJECT
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
- Force Users to Use Secure Password
- Iptables rule to safeguard SSH server from crackers
- How to restrict or allow SSH access to certain users only in Linux
Tags: brute-force, firewall, iptables, linux, secured shell, security, ssh, ubuntu
Keep updated with the latest posts, be a part of over 1,000 subscribers! :
Subscribe to your email
You might also want to read...
- Iptables rule to safeguard SSH server from crackers
- How to secure your SSH server
- How to: Quick and Dirty Web Server Load Balancing with IPTables in Linux
- Solving SSH “channel 3: open failed: administratively prohibited” error when tunnelling
- How to secure server from SYN-flood attack using iptables
- How to Enable Outgoing Keyserver port with iptables firewall
- How to limit MySQL port access to specific network


July 26th, 2011 at 11:44 pm
You can also use tcpwrapper to control the connection to the service.
July 28th, 2011 at 7:12 pm
Not for Archlinux users: http://www.archlinux.org/news/dropping-tcp_wrappers-support/
November 26th, 2012 at 12:40 am
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