Permission denied in ec2 port 80

Hello all,
Thanks for sharing this great app. I was able to deploy an app in ec2 and access it externally with port 8501. But when i set the server.port =80 I got permission denied.
I already opened port 80 in the security group in ec2.
Any idea?

You need sudo permission/root account for use the port 80.

thanks, so how to run streamlit with sudo

1 Like

Hi @moh555m555

For security reasons, I would not recommend you run Streamlit with sudo. Rather, take a look at this tutorial on how to set up a webserver (namely Nginx) to route requests from port 80 to other ports running various applications.

In your case, you only need to route requests from the β€œ/” route to your Streamlit app, wherever that may reside (e.g. port 8501).

Most web servers commonly available on EC2 instance deployments can accomplish this. Here’s how to forward requests to 80 to another port (8080 in this example) using Apache2.

Thanks for your question – please keep us updated on your experience using Streamlit as a web app!

1 Like

Thanks. I got it working by redirecting default port 80 to 8051 in iptables.

1 Like

I am new to ubantu. I got the same Permission denied. Could you show me how to run streamlit with sudo? Thanks a lot!

streamlit run NTUT-AutoML-v1.1.py --server.port 443

I was trying to use port 443, but get error: Permission denied. Please help! (Running in AWS EC2: Window Server 2019 with ubuntu installed. Which means I ran ubuntu inside Windows Server)

@moh555m555 Can you explain or link to how you did this with iptables?

1 Like