Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!ogicse!ucsd!ucsdhub!hp-sdd!hplabs!hpfcso!hpfcmgw!hpfcse!hpuecoz!hpuecoa!speclab!rclark From: rclark@speclab.bgp-usgs.gov (Roger N. Clark) Newsgroups: comp.sys.hp Subject: Re: removable r/w optical disk Message-ID: <210045@speclab.bgp-usgs.gov> Date: 26 Feb 90 18:26:07 GMT References: Organization: U.S. Geological Survey, Branch of Geophysics, Denver Lines: 157 > We just installed the r/w optical disk on our HP9000/300 running HP-UX6.5. > We want each user to be able to have a mount point in their home directory > and mount/umount the optical disk. > Is there any way to mount/umount file system without being a superuser. We have an optical disk and have the same problem. Below is a simple mount and unmount program. They get installed as set UID root. On our system, the optical disk is /i2 and the users can only mount and unmount /i2, but you can change /i2 to anything you want. If a user is using a disk, another user can't unmount it as long as a process has a directory on /i2 as a working directory. There is no manual, but the c programs are 2 lines long and should be obvious. Root should run the make. Roger Clark ..!speclab!rclark #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Roger N. Clark on Mon Feb 26 10:48:52 1990 # # This archive contains: # makefile mounti2.c umounti2.c # # Existing files will not be overwritten. # Error checking via wc(1) will be performed. # Error checking via sum(1) will be performed. unset LANG if sum -r /dev/null 2>&1 then sumopt='-r' else sumopt='' fi if test -f makefile then echo Ok to overwrite existing file makefile\? read answer case "$answer" in [yY]*) echo Proceeding;; *) echo Aborting; exit 1;; esac rm -f makefile if test -f makefile then echo Error: could not remove makefile, aborting exit 1 fi fi echo x - makefile cat >makefile <<'@EOF' all: /usr/bin/mounti2 /usr/bin/umounti2 /usr/bin/mounti2: mounti2.c cc -o mounti2 mounti2.c mv mounti2 /usr/bin/mounti2 chmod 4555 /usr/bin/mounti2 /usr/bin/umounti2: umounti2.c cc -o umounti2 umounti2.c mv umounti2 /usr/bin/umounti2 chmod 4555 /usr/bin/umounti2 @EOF set `sum $sumopt mounti2.c <<'@EOF' main() { system ("/etc/mount /dev/dsk/c6d0s2 /i2"); system ("/bin/chmod 775 /i2"); } @EOF set `sum $sumopt umounti2.c <<'@EOF' main() { system ("/etc/umount /i2"); system ("/bin/chmod 000 /i2"); } @EOF set `sum $sumopt