Operating System - HP-UX
1753877 Members
7596 Online
108809 Solutions
New Discussion юеВ

Mounting optical platters

 
Richard Ray
Advisor

Mounting optical platters

I have an optical jukebox on a machine running HP/UX 10.20.
Is there a way to let users other than root mount platters?
3 REPLIES 3
Steve Steel
Honored Contributor

Re: Mounting optical platters

Hi


try www.software.hp.com

download sudo

allow mounts via that


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
harry d brown jr
Honored Contributor

Re: Mounting optical platters

Not if they are mounted to a filesystem, because only root can do such. You could provide sudo or a setuid script (as root) to do such.

live free or die
harry
Live Free or Die
Olav Baadsvik
Esteemed Contributor

Re: Mounting optical platters

Hi,

Two programs you may use, one for mounting,
one for unmounting. This for mount/unmount
of CD, so you may have to do some changes.
Device-file and mount-point are hardcoded,
but you may rewrite the program to have
them take this as arguments.
You will however have to consider the
securityrisk involved. After all there is
a reason why you normally have to be root
to mount/unmount
/* Program that gives a regular user the ability to mount a cd.
. Compile the program
. Make root the owner of the executable.
. chmod 4755 executable
Olav Baadsvik Oslo Norway.
*/
#include
#include
#include
#include

main ()
{
int ios;
struct cdfs_args cda;
char buf[128];

setuid(geteuid());
setgid(getegid());

cda.fspec="/dev/dsk/cdrom";

ios=sysfs(GETFSIND, MNTTYPE_CDFS);
/* printf ("sysfs for %s er 0x%x\n", cda.fspec, ios); */

sysfs(GETFSTYP, ios, buf);
/* printf ("sysfs fstyp er >%s<\n", buf); */

ios = mount ( cda.fspec, "/CDROM",
( MS_DATA|MS_RDONLY),
MNTTYPE_CDFS,&cda, sizeof(cda) );

/* printf ("ios=%d\n", ios); */
if (ios) perror ("cdmount");
}


#include
#include
#include

main ()

{
setuid(geteuid());
setgid(getegid());
umount("/CDROM");
}