Hi guys, I have another problem now, When I try sending my public key to my servers, in some I get the info below, if I get the permission denied in more than 2 servers the program remain in loop. Is there any solution to pass the permission denied and jump to the next server from array?
ecosta@trr-ntripc-alp's password:
Permission denied, please try again.
ecosta@trr-ntripc-alp's password:
/usr/local/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/local/bin/ssh-copy-id: INFO: 2 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ecosta@trr-ntripc-bet's password:
/usr/local/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
ecosta@trr-ntripc-alp's password:
Permission denied, please try again.
ecosta@trr-ntripc-alp's password:
Permission denied, please try again.
ecosta@trr-ntripc-alp's password:
foreach my $hostname(@_){ 163 # print $hostname,"\n"; 164 165 my $scp_exp = new Expect; 166 # Run the copy command. 167 $scp_exp->spawn("ssh-copy-id $user\@$hostname") or die " +Cannot spawn ssh-copy-id: $!\n"; 168 $scp_exp->log_file("./autossh-copy-id.log"); 169 $scp_exp->expect(2, 170 [qr/\(yes\/no\)\?\s*$/ => sub { $scp_ +exp->send("yes\n"); exp_continue } ], 171 [qr/assword:\s*$/ => sub { $scp_exp-> +send("$pass\n"); exp_continue; } ], 172 #[timeou => sub { die "Permission den +ied.\n"; } ], '-re','$'); 173 #[qr/Permission denied, please try ag +ain\s*$/ => sub { exp_break; } ], 174 #[EOF => sub {my $exph = shift; my $e +rror = "Error: Could not login, EOF!"; &logerror($error, $hostname); + exp_break; } ], 175 #[timeout => sub {$exph = shift; $err +or = "Error: Could not login, timeout!"; &logerror($error, $hostname) +; exp_break; }],'-re', '$'); 176 ); 177 #$scp_exp->send("\cC"); 178 # $scp_exp->interac +t(); 179 $scp_exp->hard_close(); 180 }
Thanks guys
In reply to Eternal Loop by edualfaia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |