C program and /dev/ttyUSB access for user

I have a C program that talks to the /dev/ttyUSB# ports. I am sure I have in the past circumvented PAM and UDEV type authorizations incorrectly to let a user (non-root) let my program work with these devices. What is an acceptable way of doing this?

In my software all I do is ask for a file descriptor as in,

int myFD = Open_port("/dev/ttyUSB0");
if (myFD >= 0)
  //elided work code

Works fine as root or when I muck about with /etc/udev/permissions.d/ which doesn’t seem to exist anymore.
There also used to be a “hotplug” group that I could let a user be part of that would work (maybe a Ubuntu thing)

Things seem to have changed or maybe I haven’t kept up with all the security stuff. What is the new method to do this in openSuse?

Perhaps, like the ttyS? devices, the ttyUSB? devices are in group uucp so you could put the user in group uucp (I don’t have USB serial devices to check).

Thanks, good thought but does not seem to do it. I have tried the uucp, tty and modem groups as well. Odd.

Yes, I am controlling telescope gear via a USB to Serial cable. Works great as root :frowning:

Sorry, uucp does the trick. Thanks. With all YAST’s flashy screen stuff after you update the user’s groups I forgot to logout and back in to let the changes take affect.

As I said works just fine now with uucp group. Thanks.

You need to add a udev rule see down in /etc/udev/rules.d/ for
examples. Try adding it at the end of the list first with a filename of
99-mydevice. You need the id numbers of the usb-serial device from

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 1 day 20:59, 2 users, load average: 0.13, 0.24, 0.31
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.29

Thanks Malcolm,

The uucp group worked and having played with udev rules in the past I’m sure that would work as well. The udev method puts the access authorization point at the device whereas the uucp group method puts the authorization point at a user level. For device control like this is the udev method preferred?

If the device id’s are static then you can add the ‘users’ group to the
udev rule.

I guess it all depends on your application and what ever is easier for

That being said, adding the user to the group will then give them
access to any devices used in the uucp group, udev will restrict it to
the device.

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 1 day 21:44, 1 user, load average: 0.03, 0.15, 0.19
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.29

Thanks to both ken_yap and Malcolm. I’m off to change some things in my app.