0

After installing ufw on several servers, I see the following rules:

To                         Action      From
--                         ------      ----
224.0.0.251 mDNS           ALLOW       Anywhere
SSH (v6)                   ALLOW       Anywhere (v6)
ff02::fb mDNS              ALLOW       Anywhere (v6)

I want to delete the SSH (v6) rule from all my servers, so I tried this:

ufw delete allow SSH (v6)

But that gave me the error

Could not delete non-existent rule
Could not delete non-existent rule (v6)

I tried

ufw delete allow SSH\ \(v6\)

But that gave me the error

ERROR: Bad port

What is the correct syntax to put into my bash script so that I can delete ufw rules that have a space in it?

0
0

Try deleting the rule by its number:

sudo ufw status numbered

And then:

sudo ufw delete <number of the desired rule>
1
  • The number changes depending on which server you're on. Is there a way to do this without knowing the line number so that I can automate this from a bash script?
    – John
    Oct 22 '20 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.