you obviously didn't read the sudo help pages, you can run the script as
user y
and let it do root things by using
sudo reboot
for example
the system should reboot when you have defined sudo correctly.

man sudo should help you further on the way :)

--

Kind regards,

Remko Lodder
Elvandar.org/DSINet.org
www.mostly-harmless.nl Dutch community for helping newcomers on the
hackerscene

-----Oorspronkelijk bericht-----
Van: Silky Manwani [mailto:[EMAIL PROTECTED]
Verzonden: donderdag 4 maart 2004 19:15
Aan: Remko Lodder
CC: [EMAIL PROTECTED]
Onderwerp: Re: [Perl-beginners] Perl script to switch user to root.


Actually, My program has a list of stuff to be done which needs to be
done as say user "x". Then I need to switch user to root as the rest of
the program needs to do stuff as user root.

so, me doing

system("sudo su root");

doesn't help as it asks for the password.


On Mar 4, 2004, at 10:08 AM, Remko Lodder wrote:

> perhaps you should let the script do something like SUDO,
> and permit it to run a single command, or limited commandset
> of root operations, even without password, (you dont want that actually
> but since sudo can log stuff, it might be what you aim for)
>
> Cheers
>
> --
>
> Kind regards,
>
> Remko Lodder
> Elvandar.org/DSINet.org
> www.mostly-harmless.nl Dutch community for helping newcomers on the
> hackerscene
>
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Silky Manwani
> Verzonden: donderdag 4 maart 2004 19:03
> Aan: [EMAIL PROTECTED]
> Onderwerp: [Perl-beginners] Perl script to switch user to root.
>
>
> Hello,
>
> I want to write a perl script to switch user (to root). The problem is
> that since it asks for the password, I am not sure how I would pass it
> thru the script. I know I can run the "su root" with the system command
> in perl, but how do I take care of passing the password.
>
> Thanks.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
> _______________________________________________
> Perl-beginners mailing list
> [EMAIL PROTECTED]
> http://lists.elvandar.org/mailman/listinfo/perl-beginners
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to