Q & A on Reserved ports in UNIX

Q: I tried to write an echo server for a UNIX workstation in my office, but I cannot open the echo port. I receive this message:


          can't bind to echo port: permission denied

Why doesn't it work?

A: Several people have variations of this question. The problem arises because the UNIX operating system protects resources. Before you can use any port less than 1000 on a UNIX systems, you must:

  1. have superuser privilege (also known as "root")
  2. make sure no other process has the port open (only one server can offer a given service).

As a practical matter, on most UNIX systems you must disable the UNIX inetd process or change the configuration file because inetd provides the echo service.