Jump to content

ssh2_connect(): Error starting up SSH connection(-5): Unable to exchange encryption keys


kat35601

Recommended Posts

Provider changed there security settings and now I am not able to connect. I get this error "ssh2_connect():  Error starting up SSH connection(-5): Unable to exchange encryption keys "

these are the keys they except now. how to I tell ssh_connect() to use one of these 

 

image.png.d64146fcdf88b416af39f664d0f23618.png

 

try {
    $connection = ssh2_connect($db['cit_host'], $port);

          if(!$connection){
        throw new \Exception("Could not connect to $host on port $port");
            }
    $auth  = ssh2_auth_password($connection, $user, $pass);
    if(!$auth){
        throw new \Exception("Could not authenticate with username $user and password ");
    }
    $sftp = ssh2_sftp($connection);
      if(!$sftp){
        throw new \Exception("Could not initialize SFTP subsystem.");
    }
    $stream = fopen("ssh2.sftp://" .(int)$sftp.'//Inbox//'.$remoteFile, 'w');
    if (! $stream) {
      echo "<td>$sftp$remoteFile</td>";
        throw new \Exception("Could not open file: ");
    }
    $file = file_get_contents($remoteFile);
    if (fwrite($stream, $file) ===FALSE){
        echo "File Not Written";

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.