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

On a server with several users I'm looking to reserve port ranges so that only one user has access to a specific port range, IE

user1: 2000-2005
user2: 2006,3003
user3: 1025

In doing so, an application spawned by that user can only access ports allotted to that user. All other ports would fail to bind. Is there a way to do this on a Linux (Ubuntu) server?

share|improve this question

I don't know if iptables owner module would help you, it will allow you to apply rules regarding the owner. You could do something like:

iptables -I OUTPUT -m owner --uid-owner=pmartinez -p tcp -m multiport --sports 2000:2005 -j ACCEPT
iptables -I OUTPUT -m owner --uid-owner=pmartinez -j REJECT

That won't avoid binding but it will block all traffic and only allow the specified ports.

share|improve this answer

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.