Skip to content

Techeons

Imagine | Explore | Innovate

Menu
  • Home
Menu

Protect your OpenSSH server on Ubuntu using UFW

Posted on September 5, 2024

To prevent abuse on your OpenSSH server, you can implement rate limiting using UFW.

To rate limit incoming SSH connections using UFW, you can use the following steps:

1) Enable UFW:

sudo ufw enable

2) Set the default policy (optional, but recommended):

sudo ufw default deny incoming

3) Rate limit SSH connections:

sudo ufw limit ssh

This will limit incoming SSH connections to 6 attempts per 30 seconds.

If you want to customize the rate limiting, you can use the following syntax:

sudo ufw limit <port> <rate> <burst>
  • <port>: The port number for SSH (default is 22)
  • <rate>: The number of attempts allowed per time period
  • <burst>: The time period (in seconds)

Example (3 attempts per 60 seconds):

sudo ufw limit ssh 3/60

4) Reload UFW:

sudo ufw reload

This will apply the new rate limiting rules.

Note: Be careful when configuring rate limiting, as it may lock you out of your own server if you set the limits too low.

Some useful UFW commands

To check the current UFW rules:

sudo ufw status

To delete a specific rule if needed:

sudo ufw delete <rule>
Share on Social Media
x facebook pinterest linkedin tumblr reddit emailwhatsapptelegrammastodon

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Nginx: How to increase timeout for Nginx
  • Cheat Sheet: Essential Git Commands
  • Setting a default shell in Linux
  • Setting up Composer on Linux
  • Switch easily between Python versions on a Mac using pyenv

Tags

ai alerting aws b2 backblaze certificate cheatsheet cloud commands data-science datalake devops dns docker dremio git gitlab infra jenkins kubernetes linux metabase minikube minio monitoring mount mysql nginx nodejs notebooks openssh php python scala secrets spark ssh ssl ubuntu ufw usb web dev tools windows xampp zeppelin

©2026 Techeons | Design: Newspaperly WordPress Theme