Hostxpeed
Login Get Started →
Security

How to Deny Specific IP

3 min read
25 views
Jun 13, 2026

Prerequisites

  • UFW installed and enabled
  • Root/sudo access

Step 1: Deny IP Address

sudo ufw deny from 203.0.113.45

Step 2: Deny IP to Specific Port

sudo ufw deny from 203.0.113.45 to any port 22

Step 3: Delete Existing Rule

sudo ufw status numbered
sudo ufw delete [number]

Step 4: Reload UFW

sudo ufw reload

Was this article helpful?