Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Aug 1999 00:18:59 -0400
From:      "David S. Jackson" <dsj@dsj.net>
To:        Ed Vander Bush <ed@metafy.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Mount CDROM from User Account
Message-ID:  <19990815001859.G20961@juno.dsj.net>
In-Reply-To: <Pine.WNT.4.10.9908142221340.203-100000@ens247>; from Ed Vander Bush on Sat, Aug 14, 1999 at 10:23:10PM -0400
References:  <Pine.WNT.4.10.9908142221340.203-100000@ens247>

next in thread | previous in thread | raw e-mail | index | archive | help
So then Ed Vander Bush (ed@metafy.com) said . . .

> I am trying to mount my cd from a user acount and I am getting the error
> "Operation Not Permitted".  It works as root.  This account is in the
> wheel group and mounting to a directory with proper permissions. What am I
> doing wrong?  Thanks.

Looks like the BSD implementation of 'mount' doesn't include 'user'
among its mount options.  Is this true, gurus?

[ hmmm...he thought...scratching his head as he read page 236 of _The
Complete FreeBSD_.  "If you come from a System V environment, you'll
notice a significant difference in format--see the man page _fstab(5)_
for the full story." ]

Anyway, you could always join sudoers and mount/umount the CD that
way, right?  

I wrote this little script below for use first with Linux.  And I just
now tried to adapt it to FBSD.  Gurus, please let me know if what I'm
doing is in error or is ill-advised!

--------------SNIP---------------(Warning: Linux centric)
#! /bin/sh

#    Syntax:  cdm [-flum]

#    This utility allows you to unmount or mount the cdrom device
#    to/from the ftp public location (/home/ftp/pub/cdrom) or the
#    normal mount location (/cdrom).

#    HISTORY:  created Aug 26, 1998.  last modified Aug 27, 1998.
#    adapted (hopefully) to FreeBSD by dsj@dsj.net Aug 14, 1999.

device="/dev/wcd0c"
mountpt="/cdrom"
ftpmountpt="/home/ftp/pub/cdrom"
mntcmd="mount -t cd9660"

case $1 in

    -f)
	sudo "$mntcmd $device $ftpmountpt"
	;;
    -l)
	mount
	;;
    -u)
	check=$(mount | grep /cdrom)
	check1=$(mount | grep /home/ftp/pub/cdrom)
	check2=$(mount | grep /dev/scd0)
	if [ -n "$check" ]; then
	    echo "umounting $check"
	    sudo  "umount $device /cdrom"
	elif [ -n "$check1" ]; then
	    echo "unmounting $check1"
	    sudo "umount $device /home/ftp/pub/cdrom"
	elif [ -n "$check2" ]; then
	    echo "unmounting $check2"
	    where=$(echo $check2 | cut -f 3 -d " ")
	    sudo "umount $device $where"
	else
	    echo "$device is not mounted"
	fi
	;;
    -m)
	sudo "mount $args $device $mountpt"
	;;
     *)
	echo "usage: cdm -f (for ftp users: requires root access) \n or -l (to show mounted directories) \n or -u (to umount /dev/wcd0c: requires root access) \n or * (to show this help resource) \n or -m (to mount to normal mount position: /cdrom  -- Requires root access)"
 
esac

-----------------SNIP------------------

Hope this helps more than it hinders.  I haven't tested this yet; its
predecessor worked under Linux, but, well...that was Linux.  Perhaps
using login classes would be more fruitful?

--
David S. Jackson                       http://www.dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
To give your sheep or cow a large, spacious meadow is the
way to control him.       --Shunryu Suzuki


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990815001859.G20961>