7.1 Firewall Security Setup - Tomato6966/Debian-Cheat-Sheet-Setup GitHub Wiki
apt-get install ufw
nano /etc/ssh/sshd_config
- in there find
#Port=22
- change it to:
Port=yourwishedport
e.g.Port=5050
, the default port is 22, so you will need to specify the new connection port in your ssh like this:ssh username@hostname -p <port>
systemctl restart ssh
systemctl restart sshd
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 22
sudo ufw allow <sshPort>
sudo ufw allow 3000:3100/tcp
sudo ufw allow 3000:3100/udp
sudo ufw enable
sudo ufw allow from 203.0.113.103
sudo ufw allow from 203.0.113.103 proto tcp to any port 22
Further examples and more detailled explanations: digital ocean blog