Networking – How to fix: “listen tcp :443: bind: permission denied” on mattermost using ansible

amazon-web-servicesansiblehttpsnetworkingpermissions

I am deploying mattermost in my AWS enviorment using ansible. I am trying to set a secure https connection, but I keep getting this error when I go into the logs:

{:"commands/server.go:112","msg":"listen tcp :443: bind: permission denied"}
{:"app/app.go:257","msg":"Stopping Server..."}
{:"app/web_hub.go:120","msg":"stopping websocket hub connections"}
{:"app/web_hub.go:125","msg":"We appear to have already sent the stop checking for deadlocks 

I sort of have an idea that its some sort of permissions error, but I am not sure how to move forward from this. Can anyone help?

Best Answer

In a Linux, only root can bind to ports below 1024. A typical Ansible use case is not running as root.

See https://docs.ansible.com/ansible/2.4/become.html about privilege escalation in Ansible.

See https://superuser.com/a/892391/155147 for possible solutions for allowing privileged port binding.