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