Host OctoPrint on remote host on port 80/443

What is the problem?

OctoPrint is not using configured port when started with sudo

I'm trying to host OctoPrint on Azure VM.
So not running on local RP, not port forwarding, etc.
It works fine with default port 5000.

If I change port to 80, or 443 octoprint config set server.port 80 --int
I get error Permission denied when starting the server, expected because of lower ports.

If I try sudo ~/OctoPrint/venv/bin/octoprint serve --iknowwhatimdoing
server starts, but using default 5000 port, not the one from config.yaml

Why is OctoPrint not using configured port when started with sudo?
How to make it use port 80/443?

What did you already try to solve it?

Searched in forum / www

Logs (syslog, dmesg, ... no logs, no support)

serve.log (4.0 KB)

Additional information about your network (Hardware you are trying to connect to, hardware you are trying to connect from, router, access point, used operating systems, ...)

Ubuntu 20.04.5 LTS VM on Azure.

I replied in your other thread, but hosting OctoPrint remotely on an Azure VM will not allow you to connect to your printer without code rewrites (or writing a plugin to replace the communication later). OctoPrint feeds gcode to the printer line by line and it connects directly to the serial port to do this.

To answer your question directly, when you run with sudo, you are as a different user, so your configuration for OctoPrint is different. The config.yaml that you edited was in the home of your user, the one that is used when you run with sudo is the root user's one, these won't be the same.

Thanks,
now it's clear about config.yaml.

Yes, I'm aware of additional work for communication with printer.
In theory sounds possible, let's see how far will I get.