home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / admin / 6859 < prev    next >
Encoding:
Internet Message Format  |  1993-01-01  |  2.0 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!gdt!ccsis
  2. From: ccsis@sunlab1.bath.ac.uk (Icarus Sparry)
  3. Newsgroups: comp.unix.admin
  4. Subject: Re: How to write a "turnin" utility??
  5. Message-ID: <C06t44.451@sunlab1.bath.ac.uk>
  6. Date: 1 Jan 93 18:11:08 GMT
  7. References: <1992Dec28.213900.14908@organpipe.uug.arizona.edu> <1992Dec29.015418.12223@doug.cae.wisc.edu>
  8. Organization: Bath University Computing Services, UK
  9. Lines: 45
  10.  
  11. In the referenced article, chris@castlab.uucp (Christian) writes:
  12. >
  13. >There is the script idea. SetUID on the script to that of a user that
  14. >has write access to the directory, and have the script copy the file name
  15. >specified to that directory. 
  16. >
  17. >how about:
  18. >
  19. ># /bin/csh
  20. >cp %1 /usr/home/instructors/directory/
  21. >
  22.  
  23. >Dunno if that helps...
  24. >
  25. >-Chris
  26.  
  27. I would strongly advise against this idea. The script is fine, except as others
  28. have pointed out it does not check against overwriting other peoples files.
  29. HOWEVER it MUST NOT be made SetUID. Doing so invites people to destroy all
  30. the instructors files!
  31.  
  32. There is a very easy approach if your system allows the 'sticky-bit' on
  33. directories to mean that only the owner of a file and the owner of the
  34. directory can remove files. A quick (but by no means foolproof) way would
  35. be to type 'ls -ld /tmp'. If the system replies with 'drwxrwxrwt' (note
  36. the final 't') then there is a good chance that this is the case.
  37. Read the manual pages to be sure.
  38.  
  39. If so, you just type
  40.     mkdir /usr/home/instructors/directory
  41.     chmod 1777 /usr/home/instructors/directory
  42.  
  43. and then use the following script.
  44. #! /bin/sh
  45. umask 022
  46. /bin/cp $1 /usr/home/instructors/directory/$USER
  47.  
  48. See the file convex.com:/pub/csh.whynot for reasons not to use csh!
  49. This approach also makes it easy for the instuctor to put a deadline
  50. as all he has to do is chmod 700 /usr/home/instructors/directory/
  51. when the time is up.
  52.  
  53. If the system does not allow the sticky-bit on directories to mean this,
  54. then you will require some kind of SUID program.
  55. I see that Luc Bussieres has provided the information about one from Purdue.
  56.