# Open port < 1024

## sylvain.bonnemaison

Hi,

I would like to allow my application to open port < 1024 from my application development environment. How to configure my system for that ?

Thanks.

----------

## Black

I'm no expert, but based on a quick Google search, it doesn't seem directly possible. The easiest way appears to be using iptables to redirect traffic from port 80 to another port.

But it begs the question: why do you need to open a root-only port under your dev environment? I'm tempted to think that if you're using the dev environment, you're testing, in which case, can't you have the connecting application use the test port as well?

Bonne journée!  :Smile: 

----------

## sylvain.bonnemaison

I need to test in the near production environment.

Maybe there is some specific settings to apply to my user account in order to be able to open root-only port. I'm thinking about sudo user or something like that. Any solution in this way ?

----------

## tgR10

maybe grsecurity and sockets options in kernel will do the trick ?

----------

## Hu

If you need to emulate production, then run the application as root, so that you can also accurately model how it behaves when it has permission to do anything it wants to the system.

----------

## causality

Or have it run as root initially, open the needed port, and then drop root privileges like some daemons will do.

----------

## cach0rr0

 *causality wrote:*   

> Or have it run as root initially, open the needed port, and then drop root privileges like some daemons will do.

 

++

This is surely the easiest way. And the safest. 

`man setuid`

----------

