UFW comment existing rule?

Solution 1:

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

Solution 2:

According to ufw man page, there is no way how to edit existing rules in-place.

Here are your options:

A) Delete, and then recreate your rule with comment

B) Use ufw app profiles to define a service, then use description section for your comment.

Tags:

Firewall

Ufw