Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a service running on port 1339. Is it possible to deny requests from localhost to this port? Currently I have an ufw rule to allow requests from a specified IP but localhost can access the port as well. I don't want users logged in to the server access the url with curl or wget, the port should only be accessible from the specified IP. Is this possible?

share|improve this question
up vote 0 down vote accepted

I guess it should be possible, with something like this:

ufw deny from to port 1339

According to ufw syntax, that's how you block an specific port on an specific ip.

share|improve this answer
You have a protocol parameter missing, the correct command would be ufw deny from to any port 1339 - but still, this doesn't work. Maybe ufw doesn't affect local traffic. Anyhow, as there are no other answers, by now I'll mark this one as accepted. – Andris Jan 31 '13 at 10:47
@Andris you're right about the parameter missing. Thanks for the correction. – boris quiroz Feb 3 '13 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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