-> su -c and sudo for executing a script as a different user On Thu, Jan 08, 2004 at 03:17:37AM +0100, Jan Minar wrote:
... definitively; but if you really wanted to know how to do it the Wrong Way:
Generally, as a Unix process exec's another one (a child), the child can't mess with the parent's internals more than with any other process'--they are just separated processes. The Unix way to terminate a process without its consent is to kill(8) it. So the last line of your script would read:
kill -KILL "$PPID"
--the shell variable $PPID stores the parent process id. AFAICT, it's a POSIX-required feature, so your sh(1) should provide it.
Hmmm, I guess the OP's intentions are as follows: - start from the root prompt - execute a script as a different user - end at the root prompt
@Rick: Just to make sure, did I understand you correctly?
I understand the contents of your, Jan's, posting, but I'm afraid I fail to understand how it applies to the OP's intentions (at least the way I see them)... Can you please hit me gently with a clue bat?
Thanks, Flo
signature.asc
Description: Digital signature