Forum > Linux

[SOLVED] How to read from a serial device without sudo-rights?

<< < (2/2)

MarkMLl:
Most distreaux have a dialout group for the serial ports, and users authorised to use them should be a member.

MarkMLl

Bogen85:

--- Quote from: MarkMLl on February 24, 2023, 06:09:23 pm ---Most distreaux have a dialout group for the serial ports, and users authorised to use them should be a member.

--- End quote ---

Ah, of course. As long as the device name is not changing, just being in the correct group should be sufficient.

Hartmut:
The solution was:
   sudo usermod -a -G dialout $USER
and to log off and log in again.

I did not know how to find out, if device '/dev/ttyS0' is owned by user group 'dialout', so I just tried it and it worked :-)

Thanks to all who helped me.

MarkMLl:
ls -lt /dev/tty* | head     and so on, where that will list the most-recently-hotplugged devices first.

You /might/ find that you need to mess around with udev rules if a particular family of serial devices isn't correctly being moved into the dialout group when hotplugged, but I don't recall having to do that for a significant number of years.

MarkMLl

Bogen85:

--- Quote from: Hartmut on February 24, 2023, 06:30:00 pm ---The solution was:
   sudo usermod -a -G dialout $USER
and to log off and log in again.

--- End quote ---

Good to hear!


--- Quote from: Hartmut on February 24, 2023, 06:30:00 pm ---I did not know how to find out, if device '/dev/ttyS0' is owned by user group 'dialout', so I just tried it and it worked :-)

--- End quote ---


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---ls -l /dev/ttyS0

--- Quote from: Hartmut on February 24, 2023, 06:30:00 pm ---Thanks to all who helped me.

--- End quote ---

MarkMLI's answer was the best one.

Navigation

[0] Message Index

[*] Previous page

Go to full version