home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / admin / 6984 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  1.3 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!caen!news.cs.indiana.edu!umn.edu!gaia.ucs.orst.edu!skyking!stanley
  2. From: stanley@skyking.OCE.ORST.EDU (John Stanley)
  3. Newsgroups: comp.unix.admin
  4. Subject: Re: Shell script to invoke su and mount CD-ROM
  5. Date: 8 Jan 1993 18:49:57 GMT
  6. Organization: Coastal Imaging Lab, College of Oceanography
  7. Lines: 17
  8. Message-ID: <1ikiclINNftf@gaia.ucs.orst.edu>
  9. References: <1993Jan8.173010.18598@csi.uottawa.ca>
  10. NNTP-Posting-Host: skyking.oce.orst.edu
  11. Keywords: su, csh, cd-rom
  12.  
  13. In article <1993Jan8.173010.18598@csi.uottawa.ca> glenn@popeye.genie.uottawa.ca (Glenn Warnock 789-3225 Algonquin Associate) writes:
  14.  
  15. >We are trying to write a script which will invoke su and mount the CD-ROM, 
  16. >but we cannot invoke su in the script and automatically give it the password.
  17. >
  18. >Any suggestions on how to solve this problem?
  19.  
  20. Write a set-uid root perl script to do it.
  21.  
  22. #!/usr/local/bin/suidperl
  23. $ENV{'PATH'} = '/bin:/usr/bin:/usr/ucb/bin:/usr/etc';   #security stuff
  24. $path = $ENV{'PATH'};                                   #security stuff
  25. $ENV{'SHELL'} = '/bin/sh' if $ENV{'SHELL'} ne '';       #security stuff
  26. $ENV{'IFS'} = '' if $ENV{'IFS'} ne '';                  #security stuff
  27. $< = $>;                                # real uid must be root for exportfs
  28. print `mount blah blah blah`;
  29.  
  30.