Skip to content

Instantly share code, notes, and snippets.

@chreniuc
Created June 4, 2019 19:06
Show Gist options
  • Save chreniuc/6c5d5a35ecc001a9a331674965e5c69d to your computer and use it in GitHub Desktop.
Save chreniuc/6c5d5a35ecc001a9a331674965e5c69d to your computer and use it in GitHub Desktop.
Install and configure ufw on debian server
# Install ufw:
apt install ufw
# Set rules back to default:
ufw default deny incoming
ufw default allow outgoing
# Allow ssh:
ufw allow ssh
# or
ufw allow 22
# Enable ufw:
ufw enable
# Disable:
ufw disable
# See rules:
ufw status verbose
# Allow multiple ports: from 6000-6007
ufw allow 6000:6007/tcp
ufw allow 6000:6007/udp
# Allow incoming traffic on a public interface on a specific port:
ufw allow in on eth0 to any port 80
# List rules by number:
ufw status numbered
# Delete rule:
ufw delete 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment