Skip to content

Instantly share code, notes, and snippets.

@nhthai2005
Last active April 10, 2022 03:41
Show Gist options
  • Save nhthai2005/ebb097d20f056d7c3f866b6127b4c646 to your computer and use it in GitHub Desktop.
Save nhthai2005/ebb097d20f056d7c3f866b6127b4c646 to your computer and use it in GitHub Desktop.
Howto enable ufw firewall on Ubuntu
#!/bin/bash
# Check ufw status
sudo ufw status
# Enable ufw
sudo ufw enable
# Check ufw status again
sudo ufw status
# To set the default UFW incoming policy to deny
sudo ufw default deny incoming
# To set the default UFW outgoing policy to allow
sudo ufw default allow outgoing
# Check configuration again
sudo ufw status verbose
" Output:
" Status: active
" Logging: on (low)
" Default: deny (incoming), allow (outgoing), deny (routed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment