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
0 answers

ssh2_scp_send(): supplied resource is not a valid SSH2 Session resource

I try to create directories and upload recursively files from some local folders in two foreach loop. All seem to be ok ssh2_connect() and ssh2_auth_password() return true. Also folders creation are ok. Folders are created in remote. But after that…
MTK
  • 3,300
  • 2
  • 33
  • 49
0
votes
1 answer

fetching files from SFTP

I want to fetch files from SFTP which are created after a given timestamp(time of last pull) in java. I am using j2ssh as of now. Please let me know if some other API supports such a feature.
singhal
  • 107
  • 2
  • 9
0
votes
1 answer

SSH2 what am I doing wrong?

I'm having trouble copying a file from my laravel project to another server. This is what I'm doing. $connection = ssh2_connect($this->ftpHostname, $this->ftpPort); if (!$connection) { throw new \Exception("Couldn't connect to…
0
votes
0 answers

SSH2 connection opendir not working on centos7

I have uploaded my local code on new server. Server is Centos 7 with PHP 5.6.31 and PHP 5.5.28. I have installed ssh2 connect library on both of my php versions. I am trying to connect to other server using below code, if…
Arpi Patel
  • 775
  • 4
  • 10
  • 23
0
votes
0 answers

PHP SSH move file to another directory

I have a lengthy PHP script that takes a form, outputs it as a csv file, uploads it to a remote server and then moves it to another directory on the server. Everything is working except for moving it to a remote folder after upload. Here is what I…
Dirty Bird Design
  • 5,333
  • 13
  • 64
  • 121
0
votes
1 answer
0
votes
0 answers

CMD, connect to SFTP with cmd command and copy file from there

I know how to use "pushd" to connect to local network driver. But some of the clients files are on sftp servers. I would like to simplify some of the jobs, but could not fine a way how to connect to clent sftp. I red about WinSCP, could not…
user6105633
0
votes
1 answer

which is more efficient for sftp: java or shell script?

We are sending hundreds of files every minute to several servers. Currently we are generating the shell scripts (as files via java) which contains only sftp commands and executing them as shell scripts. The reason why we are using java is to…
Rajeshkumar
  • 815
  • 12
  • 35
0
votes
1 answer

How to bind a local address as the source address while using Ganymed API to SFTP?

We are deploying a Java project on Linux Server. A file is generated by the project which is then sent to a remote server. It was earlier implemented using Jsch. However, due to its dependency on JCE and the inability to upgrade the java version…
Arcane
  • 151
  • 1
  • 11
0
votes
1 answer

Why can't install php-ssh2 on my win7?

I do as some material say. 1. download php extension ssh2 from http://windows.php.net/downloads/pecl/releases/ssh2/0.12/ i select php_ssh2-0.12-5.4-ts-vc9-x86.zip to download. 2. extract the downloaded file there are thress files…
showkey
  • 482
  • 42
  • 140
  • 295
0
votes
1 answer

Error while trying to get content of a file using fopen and SSH2

I'm trying: -to connect to the server -to list all the files -to read the files and echo the content. The connection work well: $conn_id = ssh2_connect('xxx.com', 22); $login_result = ssh2_auth_password($conn_id, 'xxxxxx', 'xxxxxxxxx'); $sftp =…
Peter
  • 1,719
  • 4
  • 22
  • 31
0
votes
2 answers

ssh2_scp_send works only on windows, but doesn't copy on linux to amazon.com

I have a little script that copy files trough ssh2 library for php. I tried on different version of php on windows and it works as expected, but when i upload the code on Linux, it fails to copy the file. Note that the php code is same, php version…
bksi
  • 1,606
  • 1
  • 23
  • 45
-1
votes
1 answer

Access denied error when trying to upload to AWS Transfer from sftp-client

I am setting a SFTP server on AWS. I am using WinSCP to test it and the files are being transferred to S3 but with some errors: The server does not support the operation. Error code: 8 Error message from server (US-ASCII): SETSTAT unsupported In my…
Mario Garcia
  • 177
  • 1
  • 4
  • 15
-1
votes
1 answer

Ssh2 sftp returns 502 Bad gateway using PHP

Im trying to upload an image to a sftp server with the following code: //$this->sftp is a fully functioning ssh2_sftp variable $remotefile = "filename.jpg"; $url = "ssh2.sftp://". intval($this->sftp)."/".$remoteFile; The image gets uploaded but the…
alex55132
  • 177
  • 1
  • 14
-1
votes
1 answer

AWS EC2: SFTP SSH2 Permission Denied

Some context: I am using Bitnami WordPress for AWS. It's on an EC2 instance. I have been using the same PEM file to both SSH & SFTP into the instance for a while and still do on several other instances without any problem using Yummy FTP Pro. Issue:…
1 2 3
8
9