Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Alright, well, what I wanted to do was to allow my users to only be allowed to access a specific port,

In example, UserA can only access port 2004 While UserB can only access ports 2009, and 2010

To be more helpful, I'll try and explain. Basically, users will be allowed to remotely access the server, and call a program through SSH. The thing is, the program allows the user to type in the port to use. Is there any way to restrict users to only be able to use certain ports...

I'm assuming I may have to some how modify the program so that a user can only access certain ports (and in turn some how assign the ports to each user), but I'm unaware of how this would be done.

share|improve this question

What you basically need is the nufw. Ubuntu's classic default firewall ufw allows just port-based restriction by manipulation of ip-tables. The nufw on the other hand, allows user-based restriction, apart from acting as a classical firewall. Here is the debian link (I'm sure ubuntu repository must also be having this):

share|improve this answer
Yes, there seems to be one for Ubuntu... Though, i'm unaware of how to use it exactly... For example, how would i go about assigning a port to a user? – Jeremia Aug 7 '12 at 0:04
You can find some examples and techniques in NuFW Handbook here: – Prahlad Yeri Aug 7 '12 at 0:18

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.