in reply to Re^3: Need help in doing SFTP via command line
in thread Need help in doing SFTP via command line

The reason being that there seems to be an offending key in the ssh/known_hosts file , which has to be overidden.

You can remove it with ssh-keygen.

  • Comment on Re^4: Need help in doing SFTP via command line

Replies are listed 'Best First'.
Re^5: Need help in doing SFTP via command line
by punitpawar (Sexton) on Oct 17, 2016 at 20:59 UTC
    It seems that I cannot connect to the SFTP server in the first place I get the following error:
    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 pres +ent on the '~/.ssh/known_hosts' file
    As suggested I tried using ssh-keyagent to get rid of the conflicting keys but that did not help
    ## 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");
    Any help on this will really be appreciated. I am stuck and not sure what to do...
      ok I got this to work by doing the following thing and by not using openSSH module
      ## Connecting to SFTP server print "\n Connecting to SFTP Server \n"; my $sftp = Net::SFTP::Foreign->new(host => $url, user => $userName, password => $password, more => [-o => 'StrictHostKeyCheckin +g no'] ); $sftp->die_on_error("unable to connect to remote host");