libcdio as non-root user

This issue has been doing my head in for hours and to be honest I've just run out of ideas.

I'm trying to use libcdio to access my /dev/cd0 drive as a normal user (in group operator) but it just isn't having it. However, root works fine.

Testing with a couple of programs I've found the port libcdio-paranoia to be the easiest to try it out with.

cd-paranoia -v -Q works fine as root but as a user in group operator it returns "
Unable find or access a CD-ROM drive with an audio CD in it."

I've also tried cd-paranoia -v -d /dev/cd0 -Q which again works fine for root but as a user returns
"**ERROR: fread (): Invalid argument"

Hopefully it's something simple but I can't for the life of me work out where this fread() is in the libcdio-paranoia source and what's causing the issue! I assume it's something to do with permissions but which permissions on what I have no idea.

It's worth mentioning that non-libcdio programs (eg. normal cdparanoia) don't have an issue with the drive when running as the user.

Hopefully someone can help.
Thanks
 
Run it under truss(1) and upload the log somewhere: truss -f -o cdparanoia.log cd-paranoia -v -d /dev/cd0 -Q

It might offer some insight where it fails as a normal user and why.

Ran that command and found this line in the resulting log file: "openat(AT_FDCWD,"/dev/pass1",O_RDWR,00) = 4 (0x4)".
And /dev/pass1's permissions are set to: crw------- 1 root operator 0x46 Apr 12 03:44 /dev/pass1 so RDWR wouldn't work for non-root.

Running chmod g+rw /dev/pass1 sorted the problem out and now it works as a user in the operator group.

So that leads me on to a question about setting this when the device is created. In /etc/devfs.conf I'll set cd0 to be owned by a "cd" group with 0660 but what about the CAM passthrough device? Should I just assume it's always pass1 and use that in devfs.conf or is there a better way to make sure the passthrough device matches up to cd0?

Thanks
 
Back
Top