Linux – Why is sudo required to start up a webserver on a given ip:port

linuxnetworkingsudo

I'm setting up a Python-based webserver on my Debian box.

Setup:

  • The Debian OS is VM based, but I've switched the VirtualBox from NAT to Bridged.
  • IP of the VM setup = 192.168.1.7 (per my router's admin screen or ifconfig).
  • I've succesfully set up my router's port forwarding for both ssh and HTTP.
  • I've successfully set up my router's dynamic dns using dyndns.com.

Regardless of the specific Python webserver I'm using (Django, CherryPy, standard library), I have to start the webserver @ 192.168.1.7:80 using sudo. Otherwise I get an error about not having permission to access the port. None of the webserver tutorials mention needing to use sudo when specifying an ip:port.

Question: why do I need to use sudo to start these webservers? Is it an indication that I shouldn't be using 192.168.1.7? Or that I'm not setting a config file properly somewhere?

Best Answer

Only processes with root permissions can listen on privileged ports. This is a standard Unix security convention.

Related Question