Search code examples
sshcomposer-phplibssh2satis

Satis - error with ssh2.sftp protocol


I am trying to host private composer repository with satis (http://getcomposer.org/doc/articles/handling-private-packages-with-satis.md)

It works fine through http protocol.

I want to secure it with ssh connection as described in security section (http://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#security)

But having errors when connecting with ssh2.sftp:// protocol.

Composer\Downloader\TransportException]                                                                                         
The "ssh2.sftp://192.168.10.30/packages.json" file could not be downloaded: Error starting up SSH connection(-43): Failed getting banner

failed to open stream: operation failed

I have already generated key pair

I added pub key to authorized_keys file on satis server.

I can connect with ssh to satis server without entering pass, so keys are working.

What i am missing or doing wrong?

UPDATE Also i had installed ssh2 module extention. It appears on output of the command php -m | grep ssh2


Solution

  • Found solution myself:

    I was using ssh key pair with password. Apparently ssh2.sftp do not like this. Generated new key pair without password.

    Secondly need to use full path from root directory. For example: ssh2.sftp://192.168.10.30/home/[username]/path/to/location/packages.json

    source: https://www.php.net/manual/en/function.ssh2-sftp.php#94651)