Error: Permission denied, cannot open /dev/ttyr0

Hello everyone
I try to communicate via rs232 over tcp / ip.

I installed the NPort 5110 drivers (1-port RS-232 serial device server)
but in node I don't have the rights.
in a terminal I try to understand why.

ls -l / dev / ttyr *
crw ------- 1 root root 33, 0 April 19 19:56 / dev / ttyr0

I told myself that I am not in the right group (dialout)


sudo chown: dialout / dev / ttyr0
sudo chmod 777 / dev / ttyr0
ls -l / dev / ttyr *
crwxrwxrwx 1 root dialout 33, April 0 19 7:56 PM / dev / ttyr0

despite that it did not work.

dmesg | grep ttyr *
[0.115918] printk: console [tty0] enabled
[1.454256] tty tty4: hash matches
[40.978938] MOXA Async / NPort server family Real TTY driver ttymajor 33 calloutmajor 38 verbose 0 (Ver5.0)
[77.712702] audit: type = 1400 audit (1587318999.001: 30): apparmor = "DENIED" operation = "open" profile = "snap.node-red.node-red" name = "/ dev / ttyr00" pid = 1481 comm = "node" requested_mask = "wr" denied_mask = "wr" fsuid = 0 ouid = 0

I must admit that I don't really know what to do, do you have an idea?

That is not a valid path in linux:
dialout/dev/ttyr0 is correct!

You really shouldn't set 777.

sudo chown root:dialout /dev/ttyr0
sudo chmod 660 /dev/ttyr0

crw-rw---- 1 root dialout 4, 67 Feb 12 22:30 /dev/ttyr0

I think this may be your issue - you seem to be using snap? I'm not really familiar with it but think it might have its own security settings?

1 Like

thank you very much, i reinstalled without snap and i have access to the port.

1 Like

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