UFW – How to Comment Existing Firewall Rules

firewallufw

I'm trying to comment an existing ufw firewall rule, but I can't find the exact command

I can easily add a rule with comment like:

sudo ufw allow in on eth0 to any port 80 comment 'test'

But how do I comment an existing rule?

Best Answer

If you add exactly same rule, then the existing rule gets overwritten and comment is updated there.

E.g.:

recyber@linux:~$ sudo ufw allow from 10.0.0.0/24 to any port 1234 comment "Comment"

Rule updated