Unable to listen on port 23

I am setting up node red on a raspberry pi to act as a protocol adaptor. I would like to have node red listen for a connection on port 23. I have a piece of old equipment that wants to connect to the pie using port 23, it would be nice for me to not change this. When I add a 'tcp in' node and set it up for port 23 I get the following error.

"unable to listen on port 23, error: Error: listen EACCES: permission denied"

Is there a way to set up the pie where nod red has access to port 23?

I appreciate any help.

You don't say which OS you have installed but I'll assume it's some brand of Linux. As a security measure only root can listen on ports <1024 which is why you get

So you need to find out which group allows a non-root user to access those ports on your Linux and assign that group to the user node-red is running as. If there is no such group then you'll have to run node-red as root and that is NOT a good idea.

Thanks for the reply Losinlt, yes it is Linux/Raspian. I am new to linux, I will google the steps you suggest. If you have time give me more details on how to accomplish this that would be great also.

All of the equipment is on a private residential network so I don't see security as a big deal. Would this make it less of a bad idea to run node red as root?


Marginally, still not a great idea though. Simple solutions now have a nasty habit of turning into nightmare's later. Say 2 years later when you've forgotten all about the original setup and suddenly realise you've an underutilised server sitting there and wouldn't it be a good idea to use that to serve up some fancy website on the cheap or extend your boiler controls to the Internet.

More importantly though, experience shows that you will end up tied in permissions knots at some point.

An alternative is to allow the node binary access to those ports by

sudo setcap cap_net_bind_service=ep /usr/bin/node

then restart Node-RED .


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.