Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am sending a file with a list of unix commands from client to server . On the server , how do I execute the commands?

Originally posted as a Categorized Question.

  • Comment on How do I execute a list of Unix commands from inside a perl program

Replies are listed 'Best First'.
Re: How do I execute a list of Unix commands from inside a perl program
by btrott (Parson) on Mar 28, 2000 at 00:26 UTC
    With extreme care.

    If you must do this, look at the system and exec commands in order to actually execute the commands. Pay particular attention to the multi-argument forms of both those functions, and use them, if possible--they're more secure.

    Also, read perlsec and run in taint mode (-T), and do security checks on the commands that the server receives.

Re: How do I execute a list of Unix commands from inside a perl program
by cleen (Pilgrim) on Feb 25, 2001 at 07:22 UTC
    IMHO with the information provided, it would be best to have the script on one server parse out the commands then do a form of remote command via ssh or kerberized (encrypted) rsh.
    open(CMDS, "file_of_commands"); while (<CMDS>) { chomp; # ssh -l username machine "$_"; }
Re: How do I execute a list of Unix commands from inside a perl program
by Anonymous Monk on Dec 04, 2003 at 05:26 UTC
    hi

    Originally posted as a Categorized Answer.

Re: How do I execute a list of Unix commands from inside a perl program
by Anonymous Monk on Mar 07, 2004 at 08:15 UTC
    open(CMDS, "file_of_commands"); while (<CMDS>) { chomp; # ssh -l username machine "$_"; }

    Originally posted as a Categorized Answer.