(LiNUX) non-root access to CDROMs

hi there …

is it possible to use a program that uses the CDROM(using SDL_CDOpen,
SDL_CDNumDrives etc.) as non-root ? if so … HOW ?!

I expect it is sufficient to make it possible for non-root to mount the cdrom
by specifying “user” in the fstab.

this would give a line like this:
/dev/cdrom /mnt/cdrom iso9660 user,noauto,ro 0 0

or is there some extra issue with SDL_CDOpen?

FrankRL

Mounting the CD-Rom is not the same as writing information to it.
Regardless of what you are trying to do the ioctl() functions at the
kernel level will need to have write permission from the user who is
running the program in order to do things like Eject, play an audio track
and all the other fun stuff you like to do with cd-roms. Mounting a
filesystem uses drivers (run with kernel permissions)
that already have this permission as a layer between the program (run by
the user who doesn’t neccessarily have write permissions) and the device
so the user doesn’t have to tell the drive to begin its spinning or any
other low level stuff.

There is a difference between filesystem mounting and direct CD control.

DaveOn Tue, 14 Mar 2000, Frank Ronny Larsen wrote:

hi there …

is it possible to use a program that uses the CDROM(using SDL_CDOpen,
SDL_CDNumDrives etc.) as non-root ? if so … HOW ?!

I expect it is sufficient to make it possible for non-root to mount the cdrom
by specifying “user” in the fstab.

this would give a line like this:
/dev/cdrom /mnt/cdrom iso9660 user,noauto,ro 0 0

or is there some extra issue with SDL_CDOpen?

FrankRL

Dave wrote:

kernel level will need to have write permission from the user who is
running the program in order to do things like Eject, play an audio track

I am not familiar with CD playback on Linux, but if a non setuid root CD
player tool can do it I beg you don’t have to be root then :wink:

There is a difference between filesystem mounting and direct CD control.

Normally you have to be root to (un)mount a filesystem manually. You
could still use automount, though.–
Daniel Vogel My opinions may have changed,
666 @ http://grafzahl.de but not the fact that I am right

In article <38CE3CD9.443569E2 at grafzahl.de>, Daniel Vogel <666 at grafzahl.de> wrote:

Dave wrote:
I am not familiar with CD playback on Linux, but if a non setuid root CD
player tool can do it I beg you don’t have to be root then :wink:

A setuid root program runs with root’s uid, so being root is necessary - unless
access to the character special file is given to the user in which case he’ll have
direct access to the hardware through the driver.

Normally you have to be root to (un)mount a filesystem manually. You
could still use automount, though.

Unless an entry in the system’s filesystem table (fstab) exists, only root can mount
and/or umount filesystems. Automount sits on top of this.--------------------------------------------------------------
Christian Zander ** N?ckersberg 76 ** 45257 Essen ** Germany
email: mbox at minion.de ** www: www.minion.de ** icq#: 5322926

Check the permissions of your CD-ROM device:
ls -lL /dev/cdrom

If they look like:
brw------- 1 root disk 11, 0 May 5 1998 /dev/cdrom
Then you’ll only be able to access the CD-ROM as root.

If they look like:
brw-r–r-- 1 root disk 11, 0 May 5 1998 /dev/cdrom
Then you’ll be able to access the CD-ROM as any user.

See ya!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

In article , Sam Lantinga
wrote:

Check the permissions of your CD-ROM device:
ls -lL /dev/cdrom

If they look like:
brw------- 1 root disk 11, 0 May 5 1998 /dev/cdrom
Then you’ll only be able to access the CD-ROM as root.

If they look like:
brw-r–r-- 1 root disk 11, 0 May 5 1998 /dev/cdrom
Then you’ll be able to access the CD-ROM as any user.

If /dev/cdrom looks like this or similar:
lrwxrwxrwx 1 root root 9 Dec 18 13:13 /dev/cdrom -> /dev/scd1
which is probably the case for most people, you’ll have to check the file that
/dev/cdrom is pointing to, /dev/scd1 in this case:

br–r----- 1 root cdrom 11, 1 Mar 2 18:23 /dev/scd1

cheers,

br–r----- 1 root cdrom 11, 1 Mar 2 18:23 /dev/scd1
And in this case only root and people in the cdrom group can access the cd
rom in a read mode.
If you don’t understand file permissions in Unix then there should be some
books or online tutorials for you to read that can update you on this.

You’re welcome. :slight_smile:

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software> On 14 Mar, Sam Lantinga wrote:

Check the permissions of your CD-ROM device:
ls -lL /dev/cdrom

that was it … thnx :wink:


“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

change the fourth column in your fstab file on the cdrom row to
noauto,owner,ro and you should be able to mount any iso9660 cd without
needing to be root…
ie:

/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0

wb at cafecom.de wrote:>

hi there …

is it possible to use a program that uses the CDROM(using SDL_CDOpen,
SDL_CDNumDrives etc.) as non-root ? if so … HOW ?!
wolfgang

hi there …

is it possible to use a program that uses the CDROM(using SDL_CDOpen,
SDL_CDNumDrives etc.) as non-root ? if so … HOW ?!
wolfgang

that was it … thnx ;)On 14 Mar, Sam Lantinga wrote:

Check the permissions of your CD-ROM device:
ls -lL /dev/cdrom

If they look like:
brw------- 1 root disk 11, 0 May 5 1998 /dev/cdrom
Then you’ll only be able to access the CD-ROM as root.

If they look like:
brw-r–r-- 1 root disk 11, 0 May 5 1998 /dev/cdrom
Then you’ll be able to access the CD-ROM as any user.