On 7/9/07, Lakshmi Sailaja <[EMAIL PROTECTED]> wrote:
It is not a single command that I am supposed to run. I have to change to a
different user and run a couple of commands.
Well, you could use sudo to launch a shell, such as /bin/sh or csh or
bash, and then use that shell to run commands. Bu
x27;t store it in a file.
Thanks & Regards,
Lakshmi
952-833-1220
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of
Tom Phoenix
Sent: Friday, July 06, 2007 2:29 PM
To: [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: Re: su and password in a Perl script
On 7/6/07, Lakshmi Sailaja <[EMAIL PROTECTED]> wrote:
my $pid = open3($wr, $rd, $er, 'sudo -S su - username');
No, you're still using su for what sudo is doing. You want to use
sudo's -u option to specify the username, maybe like this:
my $pid = open3($wr, $rd, $er,
"sudo -S -u $username
let me know if I am missign something!!!
Thanks & Regards,
Lakshmi
952-833-1220
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of
Tom Phoenix
Sent: Thursday, July 05, 2007 5:54 PM
To: [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: Re: su and password in a
On Jul 5, 8:48 pm, [EMAIL PROTECTED] (Lakshmi Sailaja)
wrote:
> Hi,
>
> I will have to login as a super user and run some commands.
>
> I want to automate the following through Perl:
> su - user
> and provide password
> check if the login is successful or not.
>
> Can you please let me know?
I >>>
On 7/5/07, Lakshmi Sailaja <[EMAIL PROTECTED]> wrote:
I want to automate the following through Perl:
su - user
and provide password
check if the login is successful or not.
You'll probably have an easier time using sudo, instead of su; it's
made for this sort of thing. See whether yours has th