Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Flask without sudo?

Is it possible to run Flask (http://flask.pocoo.org/) as the standard user?

I need to run a web service on my Pi, but am not sure how safe it would be running it as a super user when it needs to be exposed to the web through my firewall.

like image 829
Lewis Lebentz Avatar asked Jun 18 '26 22:06

Lewis Lebentz


1 Answers

It is, you simply cannot bind to port 80 as a regular user.

There are plenty of workarounds, though. This question is a good reference: Is there a way for non-root processes to bind to "privileged" ports on Linux?

--

Usually the workaround is either to give your Flask (Python) capabilities to bind to port 80, or to simply setup an iptables rule that redirects traffic from port 80 to whatever port Flask is listening on.

like image 96
Thomas Orozco Avatar answered Jun 20 '26 12:06

Thomas Orozco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!