Launching Flask on Port 80 without using sudo

Flask is a great python based HTTP server that’s really small and easy/fast to setup, it is really useful for deploying small Web based User Interfaces for IoT type devices.  By default flask will attach itself to port 5000.  To get my flask script to attach to port 80 I use:

if __name__ == '__main__':'', port=80, debug=True)

This works fine, the only problem is that in order to successfully attach to port 80 the script must be run as root, so instead of just running:


I have to run:

sudo ./

Which isn’t great.

To get around this problem I used the tool: authbind

To Install:

sudo apt-get install authbind

And configure it for access to port 80:

sudo touch /etc/authbind/byport/80

sudo chmod 777 /etc/authbind/byport/807

(Not sure if the very loose 777 permission is required, must experiment)

Now I just have to launch my flask UI script using authbind and it will take care of the script’s permissions to bind to port 80 and I can connect from a browser:

authbind -deep python3 ./

More info on authbind here