How do I limit access to a ufw app/service (not port) by IP address?

By flickerfly

I know how to allow only a specific IP address into a port, but I can’t find the syntax to do this by service. I kinda like having the services so I can group and read my rules more easily.

How do I allow an IP address to a app like ssh, or in this case mongodb?

I tried the following:

sudo ufw allow Mongodb from
sudo ufw allow from to Mongodb

I read through the man page, bit it doesn’t seem to address apps much more than anywhere else on the Internet.


Leave a Reply