home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.admin
- Path: sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!dirac.physics.uq.oz.au!werner
- From: werner@physics.uq.oz.au (Michael Werner)
- Subject: Re: NFS mounting and exporting question
- Message-ID: <By3BsG.46B@bunyip.cc.uq.oz.au>
- Sender: news@bunyip.cc.uq.oz.au (USENET News System)
- Reply-To: werner@dirac.physics.uq.oz.au
- Organization: Department of Physics, University of Queensland
- References: <1ej1llINN9hs@usenet.INS.CWRU.Edu>
- Date: Sat, 21 Nov 1992 23:55:28 GMT
- Lines: 56
-
- One way is to write a small C program to mount the optical disk.
- You can then allow particular users to execute the program via /etc/group.
- You will also have to set the setuid bit. An example program follows.
-
-
- #ifdef SYSV
- #ifndef hpux
- #define vfork() fork()
- #endif
- #endif
-
- #include <stdio.h>
- #include <signal.h>
- main()
- {
- int status, pid, w;
- register int (*istat)(), (*qstat)();
-
- if ( setuid(0) ) {
- perror("setuid(0)");
- exit(1);
- }
- if ((pid = vfork()) == 0) {
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- signal(SIGHUP, SIG_DFL);
- execl("/usr/etc/mount","mount","/dev/optdsk0","/mo",0);
- _exit(127);
- }
- istat = signal(SIGINT, SIG_IGN);
- qstat = signal(SIGQUIT, SIG_IGN);
- while ((w = wait(&status)) != pid && w != -1)
- ;
- if (w == -1)
- status = -1;
- signal(SIGINT, istat);
- signal(SIGQUIT, qstat);
- return(status);
- }
-
- --
- Yours,
-
- Mike
-
- ----------------------------------------------------------------------------
- + +
- + * * Michael Werner +
- + * * werner@dirac.physics.uq.oz.au +
- + * * Theoretical Quantum Optics, +
- + ------- Department of Physics, +
- + * * University of Queensland. +
- + * * St. Lucia. 4072. Australia +
- + * * +
- + +
- ----------------------------------------------------------------------------
-