I managed to remove the prompt asking for yes or no but cannot make it work for adding the public key using ssh-copy-id.
this is the code, note that with push it never worked.any ideas? thank you#!/usr/bin/perl use Expect; use strict; use warnings; $Expect::Debug = 1; my $pass= '****'; my $timeout = 1; # chomp (my @devices = `cat sample.txt`); print "@devices\n"; # ## These is to bypass the prompt of each node for new ssh connection. foreach my $device (@devices) { # create an Expect object by spawning another process #push @params, $device; print $device; my $exp = Expect->spawn("ssh-copy-id $device"); if ($exp->expect($timeout, 'password')){ $exp->send("$pass\r"); } }
In reply to Re^4: parse /etc/passwd and output it as csv in hundred servers
by garcimo
in thread parse /etc/passwd and output it as csv in hundred servers
by garcimo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |