jnbarlow/monero-dashboard

Provide Elevated Access to port 80

Closed this issue · 4 comments

I am running this node on a raspberry pi, and set the .env variable PORT=80. Running sudo npm start did not provide the privileges necessary. How do I grant the node.js access to port 80?

Hmm. In Ubuntu, sudu npm start is all that is necessary to make it work on 80. What distro are you running on your PI? What's the error message it's giving you?

Running Raspberry Pi OS(updated version of Raspbian).
Here are the errors:

glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}

up to date in 8s
events.js:291
throw er; // Unhandled 'error' event
^

Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (net.js:1293:21)
at listenInCluster (net.js:1358:12)
at Server.listen (net.js:1444:7)
at Function.listen (/home/pirate/monero-dashboard/node_modules/express/lib/application.js:618:24)
at Object. (/home/pirate/monero-dashboard/server/index.js:24:5)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1337:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EACCES',
errno: 'EACCES',
syscall: 'listen',
address: '0.0.0.0',
port: 80
}

oh interesting. So it's throwing an error trying to write logs and gain access to the port. I wonder if the first is cascading into the 2nd.

Try creating that path as root (/root/.npm/_logs) and providing access chmod -r 755 /root/.npm then running it again.

@cntrl-z-forlife Try adding this to /etc/sysctl.conf

net.ipv4.ip_unprivileged_port_start=0