[Israel.pm] How to use Unix "su" (=switch user) command

Gabor Szabo gabor at pti.co.il
Wed Sep 22 00:03:11 PDT 2004


On Wed, 22 Sep 2004, Shulamit Ochayon wrote:

>
> Hi,
>
> I need from a perl script to connect another user by "su" command - switch user -
> and run another script in this user.
> How can I implement it?

The short answer is that you cannot if the originating user is not root.

The longer one is that for this either you need to provide the
username/password and if you need to make it automatic then you
have to hard-code the password which is not healthy.

Check out the sudo utility which is not related to perl but probably that
is the thing that can give you the answer.


>
> Since I'm not in perl at perl.org.il group, I will be happy if you send the answer
> to my private inbox: shulamito at amdocs.com

Her "nomail" flag was reset since then.

Gabor



More information about the Perl mailing list