Re: Executing commands through Perl



Teresa Thomas wrote:
Perl's system() function seems to be working great for simple commands like 'pwd' , 'ls' that does not require user interaction. But when I try to execute commands that require user input (eg, su or yum while not on root), then it says 'standard in must be a tty' and fails.

Is this because Perl is not inheriting the standard input properly? Any ideas on how I can fix it?

You can't run su except from a terminal. This is not part of Perl, it's part of the security for su. There's no way around this.

If you want the program to access files not normally allowed by permissions, you set the program's owner to grant access and set its set-userid-on-execution bit (see `man chmod`). The program then runs as it's owner userid rather than that of the person running it.


--
Just my 0.00000002 million dollars worth,
Shawn

"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
.