my $ssh = Net::OpenSSH->new(
$ip,
master_opts => [-o => "StrictHostKeyChecking=no"],
password=>$password,
user => $user);
####
client obj: $VAR1 = bless( {
'hostname' => 'qaclient6.omneon.local',
'ip' => '10.4.96.106',
'os' => 'linux',
'password' => 'passwd',
'ssh' => bless( {
'_batch_mode' => undef,
'_ctl_path' => '/root/.libnet-openssh-perl/root-10.4.96.106-27838-53771',
'_default_argument_encoding' => undef,
'_default_ssh_opts' => undef,
'_default_stderr_fh' => undef,
'_default_stdin_fh' => undef,
'_default_stdout_fh' => undef,
'_default_stream_encoding' => undef,
'_error' => 0,
'_error_prefix' => [],
'_expand_vars' => undef,
'_external_master' => undef,
'_gateway_args' => undef,
'_home' => '/root',
'_host' => '10.4.96.106',
'_host_squared' => '10.4.96.106',
'_key_path' => undef,
'_kill_ssh_on_timeout' => undef,
'_login_handler' => undef,
'_master_opts' => [
'-o',
'StrictHostKeyChecking=no'
],
'_master_stderr_discard' => undef,
'_master_stderr_fh' => undef,
'_master_stdout_discard' => undef,
'_master_stdout_fh' => undef,
'_mpty' => bless( \*Symbol::GEN1, 'IO::Pty' ),
'_passphrase' => undef,
'_passwd' => '@BAJ@A"',
'_perl_pid' => 27838,
'_pid' => 27840,
'_port' => undef,
'_proxy_command' => undef,
'_rsync_cmd' => 'rsync',
'_scp_cmd' => undef,
'_ssh_cmd' => 'ssh',
'_ssh_opts' => [
'-l',
'root'
],
'_target_os' => 'unix',
'_thread_generation' => 0,
'_timeout' => undef,
'_user' => 'root',
'_vars' => {},
'_wfm_bout' => ''
}, 'Net::OpenSSH' ),
'user' => 'root'
}, 'MGRemoteHost' );
####
my $cmd = 'mount -t cifs //$server->ip}/myscripts /mnt/mgscripts -o user=qauser,password=Tester-01';
push @cmds,$cmd;
$ssh->open_ex( { stdin_pipe => 1,stdout_pipe => 1, stderr_pipe => 1 }, @cmd )
or my $error = "open_ex failed: " . $opts->{ssh}->error;
####
"cd /mnt/mgscripts/latest' via open_ex and I get:
'bash: line 0: cd: /mnt/mgscripts/latest: No such file or directory'
####
'//10.20.56.64/myscripts/ on /mnt/mgscripts type cifs (rw,mand)'
####
'cd /mnt/mgscripts/latest;ls'
####
$VAR1 = [
'bash: line 0: cd: /mnt/mgscripts/latest: No such file or directory',
'Can\'t open perl script "CreateFiles.pl": No such file or directory'
];
####
'mount;sleep 10;cd /mnt/mgscripts/latest;sleep 10;ls'
####
'//10.20.56.64/myscripts/ on /mnt/mgscripts type cifs (rw,mand)'