Connecting to SFTP Server unable to connect to remote host: the authenticity of the target host can't be established, the remote host public key is probably not present on the '~/.ssh/known_hosts' file #### ## doing a ssh-keygen print "\n Disabling StrictHostKeyChecking \n"; my %opts =(password => $password); my $ssh = Net::OpenSSH->new($hostName, %opts, master_opts => [-o => "StrictHostKeyChecking=no"] ); ## Connecting to SFTP server print "\n Connecting to SFTP Server \n"; my $sftp = Net::SFTP::Foreign->new(host => $url, user => $userName, password => $password ); $sftp->die_on_error("unable to connect to remote host");