sudo ufw status查看防火墙状态
[email protected]:/$ sudo ufw status
Status: active
sudo ufw disable关闭防火墙
[email protected]:/$ sudo ufw disable
Firewall stopped and disabled on system startup
[email protected]:/$ sudo ufw status
Status: inactive
sudo ufw enable启动防火墙
[email protected]:/$ sudo ufw enable
Firewall is active and enabled on system startup
[email protected]:/$ sudo ufw status
Status: active
sudo ufw allow 端口打开某个端口
[email protected]:/$ sudo ufw allow 22
Rule added
Rule added (v6)
[email protected]:/$ sudo ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
sudo ufw delete allow 端口关闭某个端口
[email protected]:/$ sudo ufw delete allow 22
Rule deleted
Rule deleted (v6)
[email protected]:/$ sudo ufw status
Status: active