Search code examples
moovweb

Why do I need to be "sudo" to run the Moovweb server?


I've downloaded the Moovweb SDK and installed it on my computer.

I ran moov login and entered in my credentials.

I generated a project using moov generate example example.com

Why do I need to type sudo moov server --auto-hosts ?

What is it doing that it needs super user access?


Solution

  • You need that root access to run service that uses port 80, or any port below 1024.

    This is linux kernel security feature.

    More detailed information:

    "Why can only root listen to ports below 1024?" at Mikael Ståldal’s blog


    Solution 1:

    If you don't want to enter root password everytime or automate that kind of task by script - learn to use sudoers.

    HowTO: Sudoers Configuration at ubuntuforums.org


    Solution 2:

    Port limit is defined in kernel source, in include/net/sock.h file.

    /* Sockets 0-1023 can't be bound to unless you are superuser */
    #define PROT_SOCK       1024
    

    To change this on your desktop (not recommended on servers) - you may compile new kernel, with PORT_SOCK set to 79 to unlock 80 port for non-root users, or set it to 0 to unlock all ports.