ufw enabled without port 22 code example
Example 1: remove port ufw
$ sudo ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] Apache Full ALLOW IN Anywhere
[ 2] OpenSSH ALLOW IN Anywhere
[ 3] Apache Full (v6) ALLOW IN Anywhere (v6)
[ 4] OpenSSH (v6) ALLOW IN Anywhere (v6)
$ sudo ufw delete 3
Deleting:
allow 'Apache Full'
Proceed with operation (y|n)? y
Rule deleted (v6)
Example 2: remove port iptables
# flag -D for delete
sudo iptables -D INPUT -i eth0 -p tcp --dport 22 -j ACCEPT