标签: ssh2

无法解析privateKey:不支持的密钥格式

在我的Mac OS Pro Majave图书专业版中,我使用SSH-KEYGEN为node.js模块SSH2生成了一个新的SSH密钥。但是,我收到错误消息:Cannot parse privateKey: Unsupported key format

我用ssh命令验证了密钥,它工作正常。但不适用于node.js模块SSH2。

在私钥文件中,标题是, -----BEGIN OPENSSH PRIVATE KEY-----而结尾是-----END OPENSSH PRIVATE KEY-----

我检查了模块ssh2-streams keyParser.js。regexp模式RE_HEADER_OPENSSH_PRIV不包含我的标题。有人可以帮忙吗?

ssh openssh node.js ssh-keygen ssh2

8
推荐指数
2
解决办法
4825
查看次数

转换可读流并将其保存为本地文件

我正在使用 ssh2-sftp-client 从远程服务器获取文件。我正在将文件放入可读流中。我想将此可读流转换为所需的文件(sample.png 作为 png 文件,sample.doc 文件作为 doc 文件等)

\n\n

这是我的代码-

\n\n
let Client = require(\'ssh2-sftp-client\');\nlet sftp = new Client();\n sftp.connect({\n    host: sftpCredentials.host,\n    port: sftpCredentials.port,\n    username: sftpCredentials.username,\n    password: sftpCredentials.password\n}).then(res => sftp.list(\'/\'))\n.then(res => {\n     const file = await sftp.get(\'/sample.png\');\n\n})\n
Run Code Online (Sandbox Code Playgroud)\n\n

我想将此文件保存在本地。文件是一个可读流,如下 -

\n\n
ReadStream {_readableState: ReadableState, readable: true, domain: null, _events: Object, _eventsCount: 3, \xe2\x80\xa6}\n    _events:Object {end: , error: , readable: }\n    _eventsCount:3\n    _maxListeners:undefined\n    _readableState:ReadableState {objectMode: false, highWaterMark: 65536, buffer: BufferList, \xe2\x80\xa6}\n    autoClose:true\n    destroyed:false\n    domain:null\n    end:undefined\n    flags:"r"\n    handle:Buffer(4) [0, 0, 0, …
Run Code Online (Sandbox Code Playgroud)

javascript node.js node-streams ssh2

8
推荐指数
1
解决办法
1万
查看次数

Node.js ssh2-sftp-client 错误:fastPut:本地服务器没有响应

我正在使用node -v v14.17.0and"ssh2-sftp-client": "^7.0.0"方法fastPut https://github.com/theophilusx/ssh2-sftp-client#sec-5-2-9

检查远程文件正常,因此连接正常。

我的环境是wsl2 Ubuntu-20.04

我面临的问题是错误

RuntimeError: abort(Error: fastPut: No response from server Local: /home/draganddrop/testi.txt Remote: Downloads/testi.txt). Build with -s ASSERTIONS=1 for more info.
    at process.J (/home/draganddrop/node_modules/ssh2/lib/protocol/crypto/poly1305.js:20:53)
    at process.emit (events.js:376:20)
    at processPromiseRejections (internal/process/promises.js:245:33)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
Run Code Online (Sandbox Code Playgroud)

我也尝试过从sftp> put /home/draganddrop/testi.txt Downloads/testi.txt控制台,它有效。

我正在使用的代码:

        let Client = require('ssh2-sftp-client');
        let sftp = new Client();
    
        let remotePath = 'Downloads/testi.txt';
        let localPath = '/home/draganddrop/testi.txt'

        const config = {
          host: 'XX.XX.XXX.XXX',
          port: '22',
          username: 'XXXXX',
          password: …
Run Code Online (Sandbox Code Playgroud)

node.js ssh2 ssh2-sftp-client

4
推荐指数
1
解决办法
8842
查看次数

安装具有自制软件和 php 7.3 的 ssh2 扩展

我在尝试ssh2使用 pecl安装扩展时遇到以下错误:

17 warnings and 3 errors generated.
make: *** [ssh2_fopen_wrappers.lo] Error 1
ERROR: `make' failed
Run Code Online (Sandbox Code Playgroud)

这是我所做的:

brew install php
brew install libssh2
pecl install ssh2-1.1.2
Run Code Online (Sandbox Code Playgroud)

那安装了 php 7.3.3,libssh2 1.8.0 并且无法安装 ssh2-1.1.2。
有没有人有解决问题的方法?谢谢!

相关链接:
https : //github.com/docker-library/php/issues/767
为 PHP 安装 PECL SSH2 扩展

homebrew pecl libssh2 ssh2 php-7.3

0
推荐指数
1
解决办法
2768
查看次数