error deleting firewall rule in GUFW [solved]

Archived topics about LMDE 1 and LMDE 2
Locked
jomaweb

error deleting firewall rule in GUFW [solved]

Post by jomaweb »

Hi

trying to delete some previous added rules in GUFW I get an error: "error executing operation" (translated from my Spanish desktop)

is there any other way to delete some user rules?

thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
CiaW

Re: error deleting firewall rule in GUFW

Post by CiaW »

I had one I wanted to delete but hadn't yet, so I tried it and got the same error. I decided to try opening it in a root terminal to see if there was any error message output and there wasn't. I checked /var/log/messages and didn't see anything. I enabled ufw logging for level warn under preferences, tried again and it just shows the command to delete the ALLOW but nothing else.

So basically I'm in the same boat... :?
User avatar
hippy
Level 3
Level 3
Posts: 107
Joined: Wed Feb 14, 2007 9:00 pm
Location: near the hills (malvern uk)

Re: error deleting firewall rule in GUFW

Post by hippy »

Try it this way:

Open a terminal and delete it from there.

example: sudo ufw delete deny 23399/tcp
hippy

"To touch the earth is to have harmony with nature." Oglala Sioux
jomaweb

Re: error deleting firewall rule in GUFW

Post by jomaweb »

sudo ufw delete allow from 192.168.1.128/tcp
ERROR: Bad source address
User avatar
hippy
Level 3
Level 3
Posts: 107
Joined: Wed Feb 14, 2007 9:00 pm
Location: near the hills (malvern uk)

Re: error deleting firewall rule in GUFW

Post by hippy »

Ah you wish to remove the Ip, i was thinking ports in my example.

Try it this way then:

sudo ufw delete allow from 192.168.1.7
hippy

"To touch the earth is to have harmony with nature." Oglala Sioux
jomaweb

Re: error deleting firewall rule in GUFW

Post by jomaweb »

sudo ufw delete allow from 192.168.1.128
[sudo] password for jose:
Could not delete non-existent rule


But you know? that rule exists. I can see it in GUFW
User avatar
hippy
Level 3
Level 3
Posts: 107
Joined: Wed Feb 14, 2007 9:00 pm
Location: near the hills (malvern uk)

Re: error deleting firewall rule in GUFW

Post by hippy »

jomaweb wrote:sudo ufw delete allow from 192.168.1.128
[sudo] password for jose:
Could not delete non-existent rule


But you know? that rule exists. I can see it in GUFW
I am not sure as to why this is not working for you, on my pc i set up the rule you have as a trial using GUFW then opened a terminal and deleted it using the command i gave above with no problems.

To try to help further please post the result of sudo ufw status

You can also check the different commands that you can use by again opening up a terminal and typing "man ufw" (without quotes) as well as that i did some searching and found this also which may help https://help.ubuntu.com/community/UFW

Hope this helps jomaweb
hippy

"To touch the earth is to have harmony with nature." Oglala Sioux
CiaW

Re: error deleting firewall rule in GUFW

Post by CiaW »

Using the syntax above didn't work for me either, but I wasn't trying to delete an IP just a port/tcp -- but it did come up with a help screen which left me confused. So I decided to read the man pages, and here's some of what it says relevant to deleting a rule:
To delete a rule, simply prefix the original rule with delete. For
example, if the original rule was:
ufw deny 80/tcp
Use this to delete it:
ufw delete deny 80/tcp
You may also specify the rule by NUM, as seen in the status numbered
output. For example, if you want to delete rule number '3', use:
ufw delete 3
So what I did was type (in a root terminal) 'ufw status numbered' (sans quotes) and got the output with numbers in front of the few rules I have. I then typed ufw delete 6 and it asked me to confirm:
Deleting:
allow 54161/udp
Proceed with operation (y|n)? y
and the rule was deleted! I then ran the ufw status numbered again to find the new number for the 2nd one I wanted to delete and realized it might be better to delete the higher number first so that the lower numbers higher on the list don't get renumbered, if you want to delete more than 1 rule. Once again, rtfm saves the day. :D
jomaweb

Re: error deleting firewall rule in GUFW [solved]

Post by jomaweb »

CiaW wrote:Using the syntax above didn't work for me either, but I wasn't trying to delete an IP just a port/tcp -- but it did come up with a help screen which left me confused. So I decided to read the man pages, and here's some of what it says relevant to deleting a rule:
To delete a rule, simply prefix the original rule with delete. For
example, if the original rule was:
ufw deny 80/tcp
Use this to delete it:
ufw delete deny 80/tcp
You may also specify the rule by NUM, as seen in the status numbered
output. For example, if you want to delete rule number '3', use:
ufw delete 3
So what I did was type (in a root terminal) 'ufw status numbered' (sans quotes) and got the output with numbers in front of the few rules I have. I then typed ufw delete 6 and it asked me to confirm:
Deleting:
allow 54161/udp
Proceed with operation (y|n)? y
and the rule was deleted! I then ran the ufw status numbered again to find the new number for the 2nd one I wanted to delete and realized it might be better to delete the higher number first so that the lower numbers higher on the list don't get renumbered, if you want to delete more than 1 rule. Once again, rtfm saves the day. :D

this way works like a charm!!!

thank's a lot CiaW
Locked

Return to “LMDE Archive”