[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: exit usage



Florian Ernst wrote:

> Hello Jan!
>
> -> 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
>
>   ------------------------------------------------------------------------
>                        Name: signature.asc
>    signature.asc       Type: application/pgp-signature
>                 Description: Digital signature

*************************************************
Thanks Florian and everyone else for your suggestions.
Yes, your perception of what I wanted is correct.
(I'm trying to automate a process for adding users)
Your previous suggestion (below) for me is what I'm trying to implement.
<<Better just run your script as
<<# su -c=<script> <username>
<<so you won't even get a user prompt to exit from.





Reply to: