my $ssh_debug = 0; # verbose logging: 0-3 ... my $session_log_name = "ssh_$host.log"; open( my $session_log_fh, ">", $session_log_name ) or die "Failed to create logfile $session_log_name: $!"; binmode( $session_log_fh, ":unix" ); # unbuffer log file ... $ssh_session{$host} = Net::OpenSSH->new( # host $host, # automatically add new host keys to the user known hosts files # enable verbosity, if enabled master_opts => ($ssh_debug) ? [ -o => "StrictHostKeyChecking=no", "-" . "v" x $ssh_debug ] : [ -o => "StrictHostKeyChecking=no" ], # authentication user => $username, password => $password, # logging master_stderr_fh => $session_log_fh, # connection parameters timeout => $loginTO, port => $ssh_port, async => 1 ); }