When you try to connect, it gives: Ошибка: Не удалось соединиться с сервером! .

 public function connect($hostname) { if($link = ssh2_connect($hostname, 22)) { if(ssh2_auth_pubkey_file($link, 'usertest', '/home/usertest/.ssh/id_rsa.pub', '/home/usertest/.ssh/id_rsa')) { return $link; } } exit("Ошибка: Не удалось соединиться с сервером!"); } 

Through putty connects successfully. Tell me, please, what could be the problem?

  • Apparently, $ hostname is incorrect. - Timur Musharapov
  • please attach the output of the command to the question: $ file /home/usertest/.ssh/id_rsa*; head -n 1 /home/usertest/.ssh/id_rsa* $ file /home/usertest/.ssh/id_rsa*; head -n 1 /home/usertest/.ssh/id_rsa* - aleksandr barakin

0