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
0
votes
1 answer

ssh2_connect define explicit TLS

Trying to connect to remote sftp using the following code: if( ! function_exists('ssh2_connect') ){ die( 'Missing ssh2_connect' ); } $callbacks = array( 'disconnect' => function( $reason, $message, $language ){ …
lior r
  • 2,220
  • 7
  • 43
  • 80
0
votes
1 answer

How can I read and download a file from a ReadableStream on an API call (Node.js)?

I am using ssh2-sftp-client to get files from a remote server, I'm running into an issue reading and downloading these files once I get() them. At first, I was able to use the get() method to download the file when the API was hit - I could also…
BluLotus
  • 139
  • 1
  • 11
0
votes
2 answers

When I try to close ssh2 connection, no response back

I wrote a php script to execute locally, on an apache server with php7.3, doing the following: access server via ssh2 check if a file exists close connection printing json data object as a response. script works without problems except for closing…
Ahmed Nasr
  • 109
  • 1
  • 10
0
votes
0 answers

SFTP move file does not trigger event

I have set an SFTP server and some triggers that I want to launch when a file is ready. In case I started before it was finished or in case there was an error with the connection, I write first to a tmp folder (using SFTP protocol) and once it is…
Gabriel Furstenheim
  • 2,969
  • 30
  • 27
0
votes
0 answers

piping sftp ReadableStream to a file does not terminate

I am trying to download (get) a file from sftp server using ssh2-sftp-client, the program does not terminate and hangs even after the events end, close is triggered on the ReadableStream and the events finish and close are triggered on the…
vumaasha
  • 2,765
  • 4
  • 27
  • 41
0
votes
1 answer

SFTP in node downloads blank files only

I've been trying for a while now to download a file from my SFTP file storage to my local machine - And visited a number of stack posts - Like this one: SFTP modules in Node to download and delete files However, I cannot get it to work. I have this…
GeorgeBT1902
  • 195
  • 2
  • 14
0
votes
1 answer

SSH2 for PHP from Software Collections

I've installed PHP 7.1 from Software Collections and running on rh-php71-php-fpm. Now i need to use ssh2 to connect to my SFTP, it doesn't come with the Software Collection one. How do i go about installing it? I've tried installing with these…
Lew Keyang
  • 11
  • 5
0
votes
2 answers

SFTP in Node.js uploading empty files

I'm having an issue with a project I'm working on whereby I'm downloading files from my FTP server using a node module called sftp-ssh2-client and then trying to pass the stream back into my FTP server but into a different directory. The code looks…
GeorgeBT1902
  • 195
  • 2
  • 14
0
votes
0 answers

Issue in returning promise in node.js

I am currently using ssh2-sftp-client library to connect with sftp but I am using keyboard-interactive on method to resolve one issue I need to return the resolve after a both connect and on method are resolved. Below is my code const Client =…
JN_newbie
  • 5,492
  • 14
  • 59
  • 97
0
votes
1 answer

SFTP Node.js - Is it possible to list files using wildcards?

I'm trying to list all files in my SFTP server from a top level folder in Node.js using the npm module ssh2-sftp-client. However, I cannot find any documentation or previous posts which discuss whether using a wildcards in the file paths is…
GeorgeBT1902
  • 195
  • 2
  • 14
0
votes
1 answer

ssh2-sftp-client getting same file over and over

Im trying to get a bunch 2k files from a Sftp server using node and ssh2-sftp-client. ftp.connect({ host: '...', port: '...', username: '...', password: '...', readyTimeout: ... …
Meisterunner
  • 222
  • 4
  • 13
0
votes
1 answer

How to shut down `ssh2` sftp server programatically

I am using the ssh2 library to create a sftp server for testing during my testing suite. The server starts successfully and tests run as expected - all is great. However, after all of the tests have been conducted the testing script does not exit as…
Ulad Kasach
  • 11,558
  • 11
  • 61
  • 87
0
votes
1 answer

ssh2: can't run the server on node js

I'm sorry if this question is duplicate, but I can't find the solution. Seems my problem is very simple but I can't understand what I'm doing wrong. I want to set up ssh client to connect to it and make some commands in shell. So the first thing -…
Merge-pony
  • 1,668
  • 3
  • 18
  • 32
0
votes
1 answer

Call to undefined method Net_SSH2::put()

I'm using PHP_SSH2 version 1.1.2 (and phpseclib version 1.0.11) and when trying to upload files, I get this error: PHP Fatal error: Uncaught error: Call to undefined method Net_SSH2::put() Here is the code I'm using: require…
kurdtpage
  • 3,142
  • 1
  • 24
  • 24
0
votes
0 answers

Add PHP libraries to WordPress

Recently, I needed to add a sftp connection in one of my WordPress template, I found a tutorial which used ssh2 (http://php.net/manual/fr/function.ssh2-sftp.php) but the ssh2 library is not in wp-includes. I found a .tgz file…
Ankomm
  • 553
  • 2
  • 7
  • 15
1 2 3
8 9