[5141] in RedHat Linux List
Re: Miscellaneous Questions:
daemon@ATHENA.MIT.EDU (Sheldon E. Newhouse)
Tue Nov 19 09:38:16 1996
Date: Tue, 19 Nov 1996 09:33:27 -0500 (EST)
From: "Sheldon E. Newhouse" <sen1@math.msu.edu>
To: redhat-list@redhat.com
In-Reply-To: <199611170535.QAA02264@forest.nuthouse.au>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
On Sun, 17 Nov 1996, Peter Moulder wrote:
> In article <9611092017.AA12900@stereotaxis.wustl.edu> "Michael J. Yanowitz" <yanowitz@stereotaxis.wustl.edu> writes:
>
> 5) Can a non-root user mount and unmount the cd-rom drive? If so how?
>
> man 8 mount; in particular, see the `user' option.
> mount needs to be suid, btw, for this to work.
I don't know if this is the same, but here is the cdrom line in my
/etc/fstab file
/dev/hdc /mnt/cdrom iso9660 ro,user,noauto 0 0
A user then can mount and unmount this with
mount /mnt/cdrom
umount /mnt/cdrom
I have a 3-disk Sanyo changer, so I have appended at the bottom a simple
perl script I wrote (called cd-control) which uses 'eject' to allow me to
list the directories on each of the 3 cdrom slots, and mount the one I
want. 'eject' also allows the user to eject the cdrom from the drive.
This is for an ATAPI IDE cdrom. If you have SCSI, you need to change
things accordingly.
Here is the script for 'cd-control'
Place this in a convenient directory (like /usr/local/bin), do a
chmod +x and enjoy.
-sen
#!/usr/bin/perl
print "This script lists the contents of the cdrom changer and gives \n";
print "the user a choice of mounting a slot\n";
print "Continue (C) or Quit (Q)?\n";
$ans = <STDIN>; chop($ans);
if (($ans eq 'c') or ($ans eq 'C')){
system("umount /mnt/cdrom");
system("eject -c 0");
system("mount /mnt/cdrom");
print "Slot 0:\n";
system("ls /mnt/cdrom");
system("umount /mnt/cdrom");
system("eject -c 1");
system("mount /mnt/cdrom");
print "Slot 1:\n";
system("ls /mnt/cdrom");
system("umount /mnt/cdrom");
system("eject -c 2");
system("mount /mnt/cdrom");
print "Slot 2:\n";
system("ls /mnt/cdrom");
print "\n";
print "Which slot do you want mounted? 0, 1, or 2 ?\n";
$ans = <STDIN>; chop($ans); print "\n";
if ($ans eq '0') {
system("umount /mnt/cdrom");
system("eject -c 0");
system("mount /mnt/cdrom");
print "Slot $ans is now mounted\n";
} elsif ($ans eq '1') {
system("umount /mnt/cdrom");
system("eject -c 1");
system("mount /mnt/cdrom");
print "Slot $ans is now mounted\n";
} elsif ($ans eq '2') {
system("umount /mnt/cdrom");
system("eject -c 2");
system("mount /mnt/cdrom");
print "Slot $ans is now mounted\n";
}
print "Contents of Slot $ans:\n"; print "\n";
system("ls /mnt/cdrom");
}
---------------------------------------------------------------------------
| Sheldon E. Newhouse | e-mail: sen1@math.msu.edu |
| Mathematics Department | |
| Michigan State University | telephone: 517-355-9684 |
| E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
---------------------------------------------------------------------------
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
________________________________________________________________________
http://www.redhat.com/RedHat-FAQ http://www.redhat.com/RedHat-Errata
http://www.redhat.com/RedHat-Tips http://www.redhat.com/mailing-lists
------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null