home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / admin / 6318 < prev    next >
Encoding:
Text File  |  1992-11-21  |  2.1 KB  |  69 lines

  1. Newsgroups: comp.unix.admin
  2. Path: sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!dirac.physics.uq.oz.au!werner
  3. From: werner@physics.uq.oz.au (Michael Werner)
  4. Subject: Re: NFS mounting and exporting question
  5. Message-ID: <By3BsG.46B@bunyip.cc.uq.oz.au>
  6. Sender: news@bunyip.cc.uq.oz.au (USENET News System)
  7. Reply-To: werner@dirac.physics.uq.oz.au
  8. Organization: Department of Physics, University of Queensland
  9. References:  <1ej1llINN9hs@usenet.INS.CWRU.Edu>
  10. Date: Sat, 21 Nov 1992 23:55:28 GMT
  11. Lines: 56
  12.  
  13. One way is to write a small C program to mount the optical disk.
  14. You can then allow particular users to execute the program via /etc/group.
  15. You will also have to set the setuid bit. An example program follows.
  16.  
  17.  
  18. #ifdef SYSV
  19. #ifndef hpux
  20. #define vfork() fork()
  21. #endif
  22. #endif
  23.  
  24. #include <stdio.h>
  25. #include <signal.h>
  26. main()
  27. {
  28.   int status, pid, w;
  29.   register int (*istat)(), (*qstat)();
  30.   
  31.   if ( setuid(0) ) {
  32.     perror("setuid(0)");
  33.     exit(1);
  34.   }
  35.   if ((pid = vfork()) == 0) {
  36.     signal(SIGINT, SIG_DFL);
  37.     signal(SIGQUIT, SIG_DFL);
  38.     signal(SIGHUP, SIG_DFL);
  39.     execl("/usr/etc/mount","mount","/dev/optdsk0","/mo",0);
  40.     _exit(127);
  41.   }
  42.   istat = signal(SIGINT, SIG_IGN);
  43.   qstat = signal(SIGQUIT, SIG_IGN);
  44.   while ((w = wait(&status)) != pid && w != -1)
  45.     ;
  46.   if (w == -1)
  47.     status = -1;
  48.   signal(SIGINT, istat);
  49.   signal(SIGQUIT, qstat);
  50.   return(status);
  51. }
  52.  
  53. -- 
  54. Yours,
  55.  
  56. Mike
  57.  
  58. ----------------------------------------------------------------------------
  59. +                                                                          +
  60. +    *          *            Michael Werner                   +
  61. +     *         *                werner@dirac.physics.uq.oz.au      +
  62. +      *     *            Theoretical Quantum Optics,        + 
  63. +       -------                        Department of Physics,             +
  64. +      *       *                        University of Queensland.          +
  65. +     *        *            St. Lucia. 4072. Australia         +
  66. +    *           *                                                         +
  67. +                                                                          +   
  68. ---------------------------------------------------------------------------- 
  69.