Questions tagged [ssh2-exec]

PHP function to execute a command on a remote server using ssh protocol.

function to execute a command on a remote server using ssh protocol.

71 questions
1
vote
1 answer

PHP Warning: PHP Startup: Unable to load dynamic library 'php_ssh2.dll' (tried: C:\xampp\php\ext\php_ssh2.dll (%1 is not a valid Win32 application

I am trying to use php_ssh2.dll(thread safe version-1.1.2) using xampp on Apache Server in PHP 7.2 running on Windows 10. My phpinfo() shows Compiler is MSVC15 (Visual C++ 2017), Architecture is x86 and Thread Safe is enabled. After downloading i…
J. Hasan
  • 492
  • 3
  • 14
1
vote
0 answers

ssh2 php, output not display

I want to display my output of my js... ::php code::
1
vote
1 answer

PHP using ssh2_exec to execute script with parameters from query

I am trying to execute a script from a server, the parameter is retrieved from MySQL query and stored into $test is there a way to use this as a parameter for my script? I have a script stored in a parameter as well $script
tiger_groove
  • 956
  • 2
  • 17
  • 46
1
vote
1 answer

Im using ssh2_exec functionin php why it doesn't pass more then 3 parameters?

Why the ssh2_exec function doesn't pass more than three parameters? $stream_1 = ssh2_exec($ssh, "/root/Script/Auto_Traces/show_ng_trace.sh $a $b $c $d $e"); In this case only $a $b $c are passing but not $d and $e, how can I solve it?
K.D
  • 21
  • 6
1
vote
1 answer

How do i execute sudo command over ssh in node JS.?

I tried remote-exec and node-ssh packages, but both are resulting the same as mentioned below. var rexec = require('remote-exec'); var connection_options = { port: 22, username: 'user', privateKey:…
1
vote
4 answers

How to end a thread in executor service if thread takes too long?

Sample executor service static class MyRunnable implements Runnable { private String serverName; public MyRunnable(String serverName) { super(); this.serverName = serverName; } @Override public void run() { …
JayC
  • 2,144
  • 8
  • 42
  • 77
1
vote
0 answers

script doesn't wait for the process end with ssh2_exec and stream_set_blocking

I have two scripts : The first one contains the folowing code:
1
vote
0 answers

nodejs - Error: Timed out while waiting for handshake

I am using remote-exec which uses the ssh2 npm package and I am getting the following error Error: Timed out while waiting for handshake The code which I am running is the following var rexec = require('remote-exec'); // see documentation for…
Alex Johnston
  • 99
  • 1
  • 7
1
vote
0 answers

SSH2 extension for PHP on Ubuntu16.04 not working

I try to use PHP + SSH2 extension to reboot my Ubuntu 16.04 machine. I successfully install SSH2 extension: And then I write the PHP code, It successfully logs in but not execute command.
ThanhLam112358
  • 878
  • 1
  • 20
  • 51
1
vote
1 answer

PHP variable in ssh2_exec command

i have a problem with putting a variable with an IP address into a ssh2 command. $somestring = 'ebtables -t filter -A FIREWALL -p IPv4 --ip-src '.$newifaceaddr.' --ip-proto tcp --ip-dport 22 -j ACCEPT'; $somevar = ssh2_exec($connection,…
1
vote
0 answers

php ssh2 auto accept 'Y' key

I'm using php ssh2 lib to execute command on server, command code as below: RSC_delete ABCD Are you sure to delete RSC data [N] ('Y' or 'N') Y As you can see it require a 'Y' key for it to execute delete. My PHP code is as follow: …
CodingNuts
  • 19
  • 1
  • 6
1
vote
1 answer

Trying to get all content of directory from one server to another using ssh2_scp_recv in php

The below script is working successfully. Getting file from one server to another if(ssh2_scp_recv($conn, '/var/www/html/captures/store/2016/04/HK/15721022890870/test/vcredist.bmp', …
sanainfotech
  • 571
  • 4
  • 11
  • 29
1
vote
1 answer

Installing ssh2 on xampp

I am trying to install ssh2 on xampp Xampp version : 3.2.1 PHP version : 5.4.19 Until now I have used following step to install: download and copied libssh2.dll file to c:\windows\system32 php_ssh2.dll and php_ssh2.pdb files in the "ext" (e.g…
user3782114
  • 542
  • 2
  • 7
  • 22
1
vote
3 answers

How to get current directory name from sftp server

I am connecting to remote sftp server using ssh2 functions. Now I need to get current directory name. In case of ftp server I can use ftp_pwd but I can't find similar function for ssh2 I need php code
user3918128
  • 101
  • 1
  • 2
  • 9
1
vote
2 answers

ssh2_exec process failing before completion PHP Bash

I've got a PHP script that executes a bash script on a remote server which fires a number of processes.
Grant
  • 1,297
  • 2
  • 16
  • 39