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:

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:

Which isn’t great.

To get around this problem I used the tool: authbind

To Install:

And configure it for access to port 80:

(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:

More info on authbind here

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *