1

I'm adding the new custom service by command

firewall-cmd --permanent --new-service=ssh2

but can't find how to remove it ...

Zaza
  • 458
  • 2
  • 7
  • 15

2 Answers2

3

I suggest:

firewall-cmd --permanent --remove-service=ssh2

See: http://www.firewalld.org/documentation/man-pages/firewall-cmd.html

Cyrus
  • 84,225
  • 14
  • 89
  • 153
  • Nop , it is not working, after removing that way , then cmd --zone=public --permanent --remove-service=ssh2 and reloading firewalld, and adding the service with the same name, getting : Error: NAME_CONFLICT: new_service(): 'ssh2' – Zaza Apr 19 '17 at 20:11
2

This is an old question; however, I think this would be useful to share.

When you create a service, a <service-name>.xml file will be created at /etc/firewalld/services/

Now, when you delete a custom service, make sure you delete the corresponding file(s) - as there may be a .xml.old file for that service - too.

firewall-cmd --permanent --remove-service=ssh2
rm -f /etc/firewalld/services/ssh2.xml*
firewall-cmd --reload

Check to see if your service is still available or not:

firewall-cmd --info-service=ssh2

This should return an error. :)

Jasonw
  • 5,054
  • 7
  • 43
  • 48
Achilles
  • 1,554
  • 1
  • 28
  • 36