ssh - Satis - ssh2.sftp 协议(protocol)出错

标签 ssh composer-php libssh2 satis

我正在尝试使用 satis (http://getcomposer.org/doc/articles/handling-private-packages-with-satis.md) 托管私有(private) Composer 存储库

它通过http协议(protocol)工作正常。

我想按照安全部分 (http://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#security) 中的说明使用 ssh 连接来保护它

但是使用 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

我已经生成了 key 对

我将 pub key 添加到了 satis 服务器上的 authorized_keys 文件中。

我可以在不输入密码的情况下通过 ssh 连接到 satis 服务器,因此 key 可以正常工作。

我错过了什么或做错了什么?

更新
我还安装了 ssh2 模块扩展。它出现在命令 php -m | 的输出中。 grep ssh2

最佳答案

自己找到解决方案:

我正在使用带密码的 ssh key 对。显然 ssh2.sftp 不喜欢这样。生成没有密码的新 key 对。

其次需要使用根目录的完整路径。例如:
ssh2.sftp://192.168.10.30/home/[用户名]/path/to/location/packages.json

来源:http://us3.php.net/manual/en/function.ssh2-sftp.php#94651 )

关于ssh - Satis - ssh2.sftp 协议(protocol)出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19831391/

相关文章:

linux - 构建后无法将 Vue CLI 应用程序推送到 github.io - 权限被拒绝(公钥)

linux - 下载 Wget 以外的文件的命令

apache - 80端口在服务器上打开但无法连接到它

php - 在本地使用 Composer 然后通过 FTP 上传文件

c++ - 安装 libssh2 时未创建 libssh2_config.h

javascript - ssh2 : can't run the server on node js

ssh - Telnet 连接后解决协议(protocol)不匹配问题

php - 使用 Composer 找不到 Google APIClient 类

php - 如何在没有 Composer 作为依赖项的情况下使用具有命名空间的 PHP 库(PSR-0)?

javascript - Node js :Not able to catch 'error' in ssh2 connection on MacOSx/Linux