How to block an IP address with ufw on Ubuntu Linux server

To block an IP address with ufw on an Ubuntu Linux server, follow these steps:

  1. Open a terminal window
  2. Check the status of ufw with the following command: sudo ufw status
  3. If ufw is not enabled, enable it with the following command: sudo ufw enable
  4. Block the IP address with the following command: sudo ufw deny from <ip_address>
  5. Verify the IP address has been blocked with the following command: sudo ufw status

Note: Replace <ip_address> with the actual IP address that you want to block.

Leave a Comment