[comp.sys.hp] Mediainit "not owner" error

tgl@g.gp.cs.cmu.edu (Tom Lane) (02/14/91)

When I try to use mediainit(1) on a floppy disk, it says
	mediainit: can't lock volume - Not owner
unless I am root.
I tried changing the ownership of the device file to be myself,
and it still wouldn't work.

What's the problem?  Can I fix things so that unprivileged users
can init a floppy?  Where in the manual is this discussed??

-- 
			tom lane
Internet: tgl@cs.cmu.edu	BITNET: tgl%cs.cmu.edu@cmuccvma

joevl@mojsys.com (Joe Vlietstra) (02/16/91)

In article <11950@pt.cs.cmu.edu> tgl@g.gp.cs.cmu.edu (Tom Lane) writes:
>When I try to use mediainit(1) on a floppy disk, it says
>	mediainit: can't lock volume - Not owner
>unless I am root.
>I tried changing the ownership of the device file to be myself,
>and it still wouldn't work.
>
>What's the problem?  Can I fix things so that unprivileged users
>can init a floppy?  Where in the manual is this discussed??

mediainit is described in "System Administration Tasks",
page 6-14.  The first step in the procedure is:
	1. Log in as the root user.
This is the only place in the documentation where it is
mentioned that only root may use mediainit.

mediainit doesn't distinguish between hard disks and floppy
disks -- it only ensures that the disk is not a mounted volume.
Requiring root to execute mediainit is a safety "feature."

Our work-around is a small shell script in /usr/local/bin:
	#!/bin/sh
	# Initialize a floppy disk
	/usr/bin/mediainit	/dev/rfloppy
This script is owned by root and has setuid.  This works for us
since we're a small company.  A larger organization may want to
use a lock file and other safety enhancements.

				Joe Vlietstra
-- 
------------------------------------------------------------------
Joe Vlietstra        | Checked Daily:  ...!uunet!mojsys!joevl
Mojave Systems Corp  | Checked Weekly: mojave@hmcvax.claremont.edu
1254 Harvard Avenue  | Iffy Routing:   joevl@mojsys.com

val@hp-lsd.COS.HP.COM (Val Walker) (02/16/91)

    Your problem may not be with the owner, but with the read/write mode of
    your dev/<file>.  To use mediainit, the /dev/<device-file> must be set
    for all levels to read/write.

    Val Walker
    (val@hplsdor)

larryc@hplvec.LVLD.HP.COM (Larry Corsa) (02/17/91)

>>  When I try to use mediainit(1) on a floppy disk, it says
>>  	mediainit: can't lock volume - Not owner
>>  unless I am root.
>>  I tried changing the ownership of the device file to be myself,
>>  and it still wouldn't work.
>>
>>  What's the problem?  Can I fix things so that unprivileged users
>>  can init a floppy?  Where in the manual is this discussed??

According to the documentation installed with my 7.05 release:

Mediainit Has Incorrect Mode
----------------------------
As of release 7.0, mediainit(1M) is no longer a setuid root command.  This
may pose some problems for generic users hoping to initialize floppy
disks.  The workaround for this problem is to execute the following
commands as root.

        chown root /usr/bin/mediainit
        chmod 4555 /usr/bin/mediainit

The mediainit(1M) command is designed to be a setuid root program.
Changing its mode in this way does not represent a security risk.

... from /etc/newconfig/ReleaseNotes


Regards,

Larry Corsa 

Technical Support Engineer     |  HPDesk address: HP0900/UX 
Measurement Systems Operation  |  HPUX address: larryc@hpisla.lvld.hp.com
815 14th Street SW             |  (303) or TELNET 679-2206 
Mail Stop CU312                |  FAX (303) or TELNET 679-5957
Loveland, CO 80537, USA        |