/dev/ttyUSB0 Permission denied

Dear Community

I"m running Node-Red in a vitual Lubuntu machine and get this error when trying to connect to USB port. I checked that my user is part of dialout group.
Dies anybody has other suggestions how to fix that?

Chris

Welcome to the forum @Chris378

Perhaps the virtual machine does not have access to the hardware.

Hi Colin

I guess in this case the file ttyUSB0 wouldn"t exist, what I also experienced, but finally it was there.

Please show us the output from the command ls -l /devttyUSB*

Should that be /dev/ttyUSB*?

Blasted keyboard! Need a new one, I think I've worn this one out and I've only been typing on it for 16 hours a day, 7 days a week for 10 years. Dunno what they make em from these days. :grinning:

Good Morning

This is:
crw-rw-rw- 1 root dialout 188, 0 Nov 8 7:22 /dev/ttyUSB0

Before, with htop I checked which user/process is running node-red, and it was root, so I added root to group dialout, but same result.
I also tried this chmod 666 /dev/ttyUSB0.
Same result.

On my server it looks like this:
image

Which is correct, USB ports should not be open as they are on yours (with the 3rd rw).

The correct approach for Node-RED to access the USB ports is to install it with its own user/group and to add that user to the dialout group. It then has all the access it requires. This is how it is set up on my server and I have 2 USB devices connected and working fine. Though personally, I specify serial devices by ID and not by the generic tty number which can occasionally swap around.

image

Hello

Yes, it seems you`re absolutely right. If I start node-red server with this
sudo -u node-red
it works.
But it was not my intention to install and run it with another user, I just followed the instructions.
Is there any way to change that, or do I have to uninstall and reinstall (but how is it correct?)

Thanks.

If you are able to take your service down for a bit, then clearing it all out and starting again would be preferable. We often see people struggling with permissions here in the forum and that is nearly always down to inappropriate use of root installs.

If you are on a Debian based server, then Dave's install script is as close to an official comprehensive install as you will get. Personally, I prefer to install and document things so that I know what to do and can debug any install problems. My alternate install has a script but it only covers installing Node-RED in a specific way. Everything else is up to you but there are examples to amend and use as you need to.

Obviously, you should also fix the permissions on the USB device configs as well. It really does "just all work" if done in one of these recommended ways.

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