Questions tagged [ssh2-sftp]

Request the SFTP subsystem from an already connected SSH2 server.

Request the SFTP subsystem from an already connected SSH2 server. An SSH connection link identifier, obtained from a call to ssh2_connect(). This method returns an SSH2 SFTP resource for use with all other ssh2_sftp_*() methods and the ssh2.sftp:// fopen wrapper.

Sample :

<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$sftp = ssh2_sftp($connection);

$stream = fopen("ssh2.sftp://$sftp/path/to/file", 'r');
?>
125 questions
11
votes
5 answers

SSH2 for PHP7 MacOS?

When trying to use ssh2_sftp($this->con); PHP 7.1.7 thinks Im looking for a function in the class. After some reading, I found that SSH2 needs to be installed from PECL ( http://php.net/manual/en/wrappers.ssh2.php ) When I went to do that, I got…
Oman
  • 133
  • 1
  • 1
  • 11
8
votes
5 answers

ssh2 node js sftp protocol Error Handshake failed

Hello i have a little problem, i developped a script sftp client with node js that connect to an sftp server and grab some files, i tested it with my local server its working, but when i tried to use it with production server i received this error…
KarimS
  • 3,812
  • 9
  • 41
  • 64
7
votes
1 answer

Assigning a name to a file being uploaded from buffer in ssh2-sftp-client?

I'm having difficulties to upload a file from buffer via ssh2-sftp-client (https://www.npmjs.com/package/ssh2-sftp-client) I'm using Multer for uploading files, then I'm just targeting req.file.buffer to access the data to be uploaded via the sftp…
Petr Fila
  • 83
  • 6
6
votes
5 answers

sftp fails with 'message too long' error

My java program uses ssh/sftp for transferring files into linux machines (obviously...), and my library for doing so is JSch (though it's not to blame). Now, some of these linux machines, have shell login startup scripts, which tragically causes the…
tomper
  • 717
  • 2
  • 11
  • 25
5
votes
1 answer

Query a remote server's operating system

I'm writing a microservice in Node.js, that runs a particular command line operation to get a specific piece of information. The service runs on multiple server, some of them on Linux, some on Windows. I'm using ssh2-exec to connect to the servers…
Rafael Sofi-zada
  • 511
  • 3
  • 14
5
votes
2 answers

PHP 7 SSH2.SFTP stat() bug work around

I have an app the uses an SFTP connection to download files. It was working correctly in PHP 5.6, not so much in PHP 7. The error I get is as follows: PHP Warning: filesize(): stat failed for ssh2.sftp ... My code is as follows: public function…
mwex501
  • 492
  • 1
  • 8
  • 23
4
votes
1 answer

Using ssh fingerprint in ssh2-sftp-client

Ok, this might need a little bit of explaination up front. I am currently working on an automation project using node-red. I want to upload and download files from an remote server using ssh. For this tasks I use this node-red package called…
Peter
  • 341
  • 1
  • 4
  • 16
4
votes
0 answers

ECONNRESET using sftp in node.js

I am getting an Error: read ECONNRESET error while connecting to a sftp for a second time, first time when it is connected data is uploaded then when connection is made for a second time on a second iteration it throws an error. const Client =…
JN_newbie
  • 5,492
  • 14
  • 59
  • 97
4
votes
0 answers

ssh2 end event invoked without an error event on connection failure

I am using ssh2 to connect to a remote sftp server. The code is as shown below: fetchFileList() { return new Promise((resolve, reject) => { const sshClient = new Client(); let isReady = false; logger.info("fetchFileList…
codename_47
  • 449
  • 2
  • 17
4
votes
1 answer

Copy images from SFTP to S3 using Lambda (node)

I am using 'ssh2-sftp-client' to do this job. So basically it works fine if I copy the file to /tmp/ folder of Lambda first and then upload it to s3. I want to point the read stream to s3 without saving in the lambda /tmp/ folder. So basically:…
johnny
  • 2,032
  • 1
  • 25
  • 45
4
votes
2 answers

Not able to call method within another method of the same class JS

I am trying to call method test in method connect of the same class. But all I am getting is "Uncaught Type Error: Cannot read property 'test' of undefined". How do I access any variables inside of sftp callback? Why is it so? Here is my…
juldepol
  • 143
  • 1
  • 3
  • 9
4
votes
2 answers

SSH connection through proxy PHP

Is it possible to establish ssh connection through proxy using php? My php code is $connection = ssh2_connect('x.x.x.x'); But it gives an error below PHP Warning: ssh2_connect(): Unable to connect to x.x.x.x I can't establish ssh connection via…
Farid Movsumov
  • 12,350
  • 8
  • 71
  • 97
4
votes
0 answers

How can I use proxy with ssh2_sftp methods in PHP?

I checked the docs but I can't find any reference to proxy usage for ssh2_sftp functions in PHP... How can I use a proxy with those functions?
napolux
  • 15,574
  • 9
  • 51
  • 70
3
votes
0 answers

ftp_ssl_connect and ftp_nlist

I need to connect to a remote system to get some files. The specs of the remote system mention that: The Protocol required is SFTP - SSH File Transfer Protocol The Port Number is 22 Before anything else, I used my FTP client app to try to log into…
Faye D.
  • 833
  • 1
  • 3
  • 16
3
votes
1 answer

Getting ERROR: ERR_GENERIC_CLIENT on sftp connect

I'm using ssh2-sftp-client module and I'm getting this error {"code":"ERR_GENERIC_CLIENT","custom":true} I have no clue what I'm doing wrong and I haven't found any solution. I tried accessing sftp server directly on the command line with the same…
William Mandang
  • 103
  • 1
  • 11
1
2 3
8 9