Enable UFW on Debian/Ubuntu and Allow only port 22

Exported on 22-Aug-2021 11:54:56


Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - UFW Firewall - prepare system & install system

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
sudo apt update && sudo apt dist-upgrade -y
sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22
echo 'y' | sudo ufw enable
sudo ufw status