brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ufw --dry-run prints the rules it would add without applying them

Ufw
~/tips/tip-ufw-dry-run-preview

sudo ufw --dry-run allow 8080/tcp

Shows what a ufw command would change without making the change.

Before I change a firewall on a remote machine, I want to see what a command would actually do.

sudo ufw --dry-run allow 8080/tcp

With --dry-run, ufw builds the rules and prints what it would do, but does not modify the running firewall or the stored rule files. It works in front of other commands too, such as delete. The output is long because ufw prints the whole rule set, so pipe it through less or grep 8080. It will not tell you whether a rule locks you out, so keep a second SSH session open.

Further reading: ufw manual page

More Ufw tips sudo ufw app update all sudo ufw show raw sudo ufw allow to 10.0.0.1 proto esp sudo ufw allow to 224.0.0.0/24 from 10.0.0.1 proto vrrp sudo ufw show listening All Ufw tips (32) All topics

Link