On Wed, Dec 21, 2005 at 10:26:38PM -0700, Ludwig Mises wrote:
> It seems that only root can access /dev/rcd0c when using tools such as
> cdrdao, cdda2wav and cdparanoia, even when the user is in the operator
> group:
> 
> $ cdparanoia -v -d /dev/rcd0c -B
> 
> Checking /dev/rcd0c for cdrom...
>         Testing /dev/rcd0c for SCSI interface
>                 generic device: /dev/rcd0c
>                 ioctl device: /dev/rcd0c
>                 Could not open generic SCSI device /dev/rcd0c: Permission 
> denied
>         Testing /dev/rcd0c for SCSI interface
> 
> uid=1000(lm) gid=1000(lm) groups=1000(lm), 0(wheel), 5(operator)
> 
> I get similar results with cdda2wav and cdrdao.  Oddly enough, cdio
> works just fine for this user.  Even changing the permissions on
> /dev/rcd0c to 644 didn't change anything and  I still get errors
> indicating that I have no permission, yet clearly the account is in
> the correct group:
> 
> $ ls -l /dev/rcd0c
> crw-r-----  1 root  operator   15,   2 Dec 15 21:32 /dev/rcd0c

operator group has only read permission.

> Is it possible to read /dev/rcd0c as a user in the operator group
> using cdda2wav or other cdrtools?  I would rather not have to use su
> or sudo just to read a CD.  And I see nothing special about cdio (i.e.
> no SUID) to make it work differently.
> 

cdio opens the CD device O_RDONLY.

the cdrtools all use libscg bits to make the actual open(2), and
it only opens the device with O_RDWR.  cdrecord needs to be able
to write to the device, obviously, but the other cdrtools shouldn't
need to.  changing this appears non-trivial.  maybe ask Joerg to
add a O_RDONLY option for opening the CD device in future cdrtools
versions on the cdwrite@other.debian.org mailing list?

cdrdao and cdparanoia are not part of the cdrtools.  cdrdao needs
to be able to write to the drive.  cdparanois ahouldn't need to
though.  the patch below for the audio/cdparanoia port opens the
device O_RDONLY, and apparently does not change cdparanoia's
behaviour.  let me know how that works for you (and anyone else).

-- 
<[EMAIL PROTECTED]>


Index: patches/patch-interface_scan_devices_c
===================================================================
RCS file: /cvs/ports/audio/cdparanoia/patches/patch-interface_scan_devices_c,v
retrieving revision 1.3
diff -u -r1.3 patch-interface_scan_devices_c
--- patches/patch-interface_scan_devices_c      16 Sep 2002 13:35:52 -0000      
1.3
+++ patches/patch-interface_scan_devices_c      22 Dec 2005 08:55:48 -0000
@@ -176,6 +176,15 @@
    }
    
    idmessage(messagedest,messages,"\t\tgeneric device: %s",generic_device);
+@@ -535,7 +579,7 @@ cdrom_drive *cdda_identify_scsi(const ch
+   }
+ 
+   if(ioctl_device)i_fd=open(ioctl_device,O_RDONLY|O_NONBLOCK);
+-  g_fd=open(generic_device,O_RDWR);
++  g_fd=open(generic_device,O_RDONLY);
+   
+   if(ioctl_device && i_fd==-1)
+     idperror(messagedest,messages,"\t\tCould not open SCSI cdrom device "
 @@ -556,6 +600,7 @@ cdrom_drive *cdda_identify_scsi(const ch
  
      type=(int)(i_st.st_rdev>>8);

Reply via email to