> On Tue, 14 Sep 2004 07:36:38 -0600, Wiggins d Anconia > <[EMAIL PROTECTED]> wrote: > > > I have a script that I use to ssh to a list of servers to run a few > > > commands. I'm trying to find a way su up & run a command - however I'm > > > in need of some inspiration as to how to pull this off. > > > > > > > Have you considered 'sudo' instead? It would make this task much > > easier, would eliminate the need to handle passwords and would provide > > further security by limiting the command that can be run. I would look > > into using it first, if you can't let us know and we might be able to > > come up with something. > > > > I don't have complete control over the remote server, so I am limited > in some ways.
Ironically.... you do, but I take your meaning. Theres no sudo available, however wouldn't this require > an interactive response anyway ?. Not if configured properly. You can tell sudo to accept a command from a particular user without requiring the password be provided, I do this so that I can access a root shell with 'sudo bash' on my personal machines. I've considered a few options from > stuid to hostkeys & I really want to run this interactively to some > extent. At the moment I do something like:- > $for N in 2 - 8; do ssh mta0${N}.fqdn; done & su - > /usr/local/bin/run_cmd at each server. I have to watch the output, to > ensure theres no mishaps and don't want to put too much logic into > this script. > Fair enough, just wanted to make sure the option had been explored. In general you are going to have to handle the data at a lower level, N::S::P allows you to do so by registering handlers, which will then invoke functions depending on the data received. I would suggest using SSH2 for all of this, and then checking out the two example scripts provided in the distribution, they can be seen online at: http://search.cpan.org/src/DROLSKY/Net-SSH-Perl-1.25/eg/ They are almost identical for running 'su -' instead of 'passwd', though you may need one extra level of indirection since you are running a command in a command. See if the example scripts help, if you are still missing something, post back.... http://danconia.org > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>