Permission denied /dev/ttyS0

Hi
I am trying to get comms between a Pico and Pi3 (Pico as kHz freq counter). Looks like serial is the best option, so I have setup the Pico to send out serial data (looks OK on a scope) and trying to use the serial pins GPIO14+15 on the Pi3 (is this dev/ttyS0 ?).

I have enabled SERIAL in Raspi Config, but when I use the serial node I keep getting Permission Denied. I have tried all sorts of permission settings from other forums but nothing fixes it.

Help !

What is the permission on the device?

ls -l /dev/ttyS*

Have you enabled the port ? And disabled Getty ?

Hi,

Have a look at this.

1 Like

crw--w---- 1 root tty 4, 64 Apr 30 10:39 /dev/ttyS0

I have enabled in the Raspi Config GUI. What is Getty ?

So this is my Debian server:

ls -l /dev/ttyS*
crw-rw---- 1 root dialout 4, 64 Mar 29 04:02 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Mar 29 04:02 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Mar 29 04:02 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Mar 29 04:02 /dev/ttyS3

You can safely change the group owner to dialout (which should already exist, if not create it). This is the traditional setting for serial ports since they were most often used for modems back in the day.

Once that is done, add the user that runs Node-RED to the dialout group. Restart and all will be well.

You could, of course, add the node-red user to group tty but that is less secure, best to stick with the well trodden path.

Thanks. I dont recall the exact command but I already added the user 'pi' to the group tty and group dialout and no change :frowning:

Did you restart the device?

@all I have fixed it, I had a hunch and disabled the SERIAL CONSOLE in the Raspi Config and all has come good, had a hunch that the port was actually in use instead. Didnt find this anywhere, how obscure!
Thanks all, appreciated.

That is a well known problem and usually listed high on any forum talking about using the serial and usb ports. So well known that probably all of us have long ago disabled the serial console and no longer think about or remember it!

getty == serial console :slight_smile:

1 Like

the pi user really should NOT be a member of the tty group

aha, well there you go then, every day a school day !

howcome ?

Didnt find that on my lookings at all anywhere, but will be part of my build checklist now for sure !!?!

Because the tty group has access to all terminals (including psudo terminals used by things like ssh and x-terms) so can effectively snoop on all terminal access including password entry.

Modern systems normally only give the tty group write access (for tools like write and wall to send terminal broadcast messages, but it is still VERY bad practice for a normal user to be a member of this group.

2 Likes

The ttyS* devices having a default ownership of tty must be a Pico specific thing. The default on a Pi is dialout as you would expect.

There doesn't seem to be a universal agreement on this setting. WSL Ubuntu on Windows for example sets ownership to root:root

1 Like

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