home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / wizards / 4748 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  2.6 KB

  1. Xref: sparky comp.unix.wizards:4748 comp.unix.questions:13516 comp.unix.programmer:5312 comp.unix.internals:1957
  2. Path: sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!dale.ksc.nasa.gov!eposnak
  3. From: eposnak@dale.ksc.nasa.gov (Ed Posnak)
  4. Newsgroups: comp.unix.wizards,comp.unix.questions,comp.unix.programmer,comp.unix.internals
  5. Subject: Re: Changing the owner of a process
  6. Keywords: process owner
  7. Message-ID: <1992Nov17.142837.21252@dale.ksc.nasa.gov>
  8. Date: 17 Nov 92 14:28:37 GMT
  9. Article-I.D.: dale.1992Nov17.142837.21252
  10. References: <1992Oct29.162445.23551@eng.ufl.edu> <1cpjs4INNn3@early-bird.think.com> <1992Nov5.152833.27744@dale.ksc.nasa.gov>
  11. Organization: NASA
  12. Lines: 50
  13.  
  14.  
  15. In article <1992Nov5.235228.1944@dale.ksc.nasa.gov> I wrote:
  16. "Is there an un-general way of changing the euid of a process from another
  17. "process?  We have an unusal requirement on our project for a 'shift-change'
  18. "where a user logs in and 'inherits' ownership processes that were running
  19. "under another euid.  Thanks in advance.
  20.  
  21. Thanks to all who responded.  I was surprised at the number of different 
  22. responses I received, (most involving setuid()) which led me to realize my 
  23. wording must've been real vague.
  24.  
  25. What I was looking for was something along the lines of how to change the 
  26. effective user id of a process who's source I may not be able to modify, by 
  27. some other means, e.g. from another process.  Many suggested writing a device
  28. driver or system call to do this.  Here is one answer along those lines. 
  29. ---
  30.  
  31. This is one of those dirty tricks I've always wanted to get around to
  32. figuring out a way to do... (without kernel source, that is)
  33.  
  34. I believe it could be done by writing a device driver. Open the device
  35. driver and write commands to it, and it does the dirty work. For
  36. instance, send it 8 bytes containing the process to change and the uid
  37. to change it to.
  38.  
  39. The uid, in every version of Unix I've seen, is stored in the proc
  40. structure in the kernel. You should be able to fiddle with this at
  41. will in a device driver, and since it's in the proc structure and not
  42. the u area, it'll always be there even if the process is swapped out.
  43. It *should* be just a matter of searching for the entry and changing
  44. it.
  45.  
  46. This technique should also serve to implement something like renice()
  47. under Xenix, which doesn't have it. (The nice value also being stored
  48. in the proc structure.)
  49. --
  50. Mark Buda
  51.  
  52. I get my monkeys for nothing and my chimps for free.
  53. ---
  54.  
  55. I would enjoy hearing from anyone who might have done this already.  Thanks.
  56.  
  57.  
  58.  
  59. -- 
  60. --
  61. Ed Posnak
  62. Harris Space Systems Corporation
  63. eposnak%core1@kssib.ksc.nasa.gov
  64.