Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can I bind() to a port number < 1024?



How can I bind() to a port number < 1024?..

Answer / chaitanya

The restriction on access to ports < 1024 is part of a (fairly weak) security scheme particular to UNIX. The intention is that servers (for example rlogind, rshd) can check the port number of the client, and if it is < 1024, assume the request has been properly authorised at the client end.

The practical upshot of this, is that binding a port number < 1024 is reserved to processes having an effective UID == root.

This can, occasionally, itself present a security problem, e.g. when a server process needs to bind a well-known port, but does not itself need root access (news servers, for example). This is often solved by creating a small program which simply binds the socket, then restores the real userid and exec()s the real server. This program can then be made setuid root.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Unix Socket Programming Interview Questions

How do I properly close a socket?

1 Answers  


If bind() fails, what should I do with the socket descriptor?

1 Answers  


of the socket? Does doing a connect() call affect the receive behaviour?

1 Answers  


Can multiple sockets use the same port?

0 Answers  


How do I get my server to find out the clients address / host- name?

1 Answers  


Why do we need socket programming?

0 Answers  


How does a socket work?

0 Answers  


What is the difference between a socket and a port?

0 Answers  


How can my client work through a firewall/proxy server?

1 Answers  


How come I get address already in use from bind()?

1 Answers  


How do I get the port number for a given service?

1 Answers  


What is active unix domain sockets?

0 Answers  


Categories