Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!orstcs!curt3028@oce.orst.edu From: curt3028@oce.orst.edu (Curt Vandetta) Newsgroups: comp.sys.hp Subject: re: removable r/w optical disk Message-ID: <16205@orstcs.CS.ORST.EDU> Date: 23 Feb 90 23:01:41 GMT Sender: usenet@orstcs.CS.ORST.EDU Reply-To: curt3028@oce.orst.edu (Curt Vandetta) Organization: College of Oceanography, Oregon State Univ., Corvallis, Or. Lines: 52 Hello folks, I've written some C-code that we user here on an HP 9000 series 370, that runs setuid to root, so it allows normal users to mount and unmount the optical disk. I worked in some SCSI commands that HP provide to disable/enable the ejection button on the drive as well, so it helps to prevent the removal of mounted media. Basically the programs work as follows: odmount - Mounts the optical to the directory /optical (This is hard coded for security reasons but can be changed to any directory you see fit, and with some work it could probably even pick a directory under the users homedir. But I had problems with this i.e. ../../etc) And changes the ownership of /optical to the user. - Then it disables the ejection button on drive to prevent someone from ejecting the mounted disk. - Then it uses a file /usr/local/etc/odlock_file to record who has the optical mounted and when they mounted it. odumount - Unmounts the optical from /optical, but only if it is invoked by the same user that mounted it or root. - Enables the ejection button so that you can take the disk out. - Clears the /usr/local/etc/odlock_file. I would be happy to send copies to anyone who wishes to try the code. We've been using it for about 3 months now and have only found one real problem (discribed later). Infact my SE has requested a copy and I just sent it to him, so I still have a shar file all ready for mailing. The one problem is that the odmount program tries to mount the disk read-write, and it really hoses the drive (i.e. reboot) when you try to mount a disk that is write protected. But I'm sure if enough people get there hands on the code someone will figure out the SCSI command (if it exists) to check the disk first, then mount it apropriately. If your interested send me mail: curt@oce.orst.edu, if I get a flood of requests check this group I might post it here or get an anonymous ftp area set up for it. Also, I'm leaving town until March 2nd so only send me one message until then :-) Thanks Curt