use Net::OpenSSH; my $public_key = "..."; my $cmd1 = <<EOC; uname -a mkdir \$HOME/.ssh chmod go-w \$HOME \$HOME/.ssh echo "$public_key" >>\$HOME/.ssh/authorized_keys EOC $cmd1 =~ s/\n/;/g; $cmd1 = Net::OpenSSH->shell_quote($cmd1); my $cmd2 = '/usr/bin/ssh -t -l usr machineD ' . $cmd1; $cmd2 = Net::OpenSSH->shell_quote($cmd2); my $cmd3 = '/usr/bin/ssh -t -i $HOME/.ssh/LeadRNCkey -l usr machineC ' + . $cmd2; system $cmd3;
In reply to Re: Quoting Solutions for Nested SSH Commands?
by salva
in thread Quoting Solutions for Nested SSH Commands?
by cmv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |