3

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.

0

1 Answer 1

8

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.

6
  • So would it be possible to run it on a port above 1024 as a regular user? Jul 2, 2014 at 16:41
  • @Lewis Yes, definitely. Jul 2, 2014 at 16:58
  • Also already runned server can process uwsgi process by socket or another port as proxy.
    – tbicr
    Jul 2, 2014 at 18:56
  • @ThomasOrozco ah well that's good to know! I'll just use a higher port instead, thanks! Jul 3, 2014 at 14:41
  • Thomas and @tbicr One more thing, is it possible to run Flask on one port but have just a simple static landing page on port 80, so I can check the webserver is running? Jul 3, 2014 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.