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

How to get exit status of PHP ssh2_exec command?

I want to get the exit status of ssh2_exec command.I tried following code but it it is giving me the output of jar file but i want only the status for success or failure.How can i get that, please help. $stream = ssh2_exec($connection, 'path of jar…
Jazz
  • 17
  • 2
0
votes
0 answers

Remote SSH is stop giving response after couple of iterations

Written java program to establish remote SSH connection and send commands to that SSH device with the help of JSch. And that code need to run infinite loop means code will establish connection with first device, sends commands to that and moves to…
mahi
  • 191
  • 1
  • 2
  • 16
0
votes
1 answer

Get directory size ssh2 php

I need to work out how i can get a directory size of a folder. Code that does work is taken from php.net $SSH_CONNECTION= ssh2_connect('xx.xxx.xx.xx', xx); ssh2_auth_password($SSH_CONNECTION, 'xxxxxxx', 'xxxxxxxxxxxxx'); function…
John Rama
  • 85
  • 9
0
votes
1 answer

ssh2_exec password encryption

How can I call ssh2_exec function in php to execute a command in a remote server without hardcoding my server password? Here's the PHP manual reference:
user3321425
  • 201
  • 1
  • 2
  • 17
0
votes
1 answer

putting strings in ssh2_exec

I am having touble with ssh2_exec putting strings in execute. $stream = ssh2_exec($connection, 'userad '. $user. ' -p '. $password); doesnt work $stream = ssh2_exec($connection, 'userad user -p password'); works
user4603311
0
votes
2 answers

Trying to Execute PHP File From Remote Server

I am trying to execute a php file from a remote server as if I am typing "php example.php" into the remote servers console. Currently it keeps trying to give back to the original server. I have tried to execute straight from php, Net_SSH2, and…
benswmay
  • 1
  • 1
  • 4
0
votes
3 answers

SSH2 and PHP not working 'Terminal'

Whenever I try and execute if (!($stream = ssh2_exec($con, "cd $dir; screen -S creative java -Xmx500M -Xms500M -jar spigot.jar" ))) { it keeps returning with 'Must be connected to a terminal.' which I can't seem to get around. How do I get…
0
votes
4 answers

Create a zip file on a remote location using PHP SSH2

I'm working on a filemanager and my users should be able to download a .zip file from their entire root directory. I'm using the follow script: $cmd = ""; if(count($files) > 0) { foreach($files as $file) { $cmd .= " ".…
-1
votes
2 answers

SSH2 to a remote machine via a webpage (html and php)

I am trying to connect to a remote linux machine via a web page, submit a command and view its output on the webpage itself. This is what i have done so far (after every step I echo a text, just so i can follow up with where the code can reach) The…
user
  • 159
  • 1
  • 6
-1
votes
1 answer

Nginx account create via PHP script?

I am trying to prepare PHP script with the new server nginx web server. Unfortunately, I havent dealt with SSH2 before for php. Maybe some good forum would be able to help me with this?
kalmer
  • 11
  • 1
-3
votes
1 answer

Parse error: syntax error, unexpected 'ssh2_exec' (T_STRING)

I want to dump mysql database with ssh connection.
showkey
  • 482
  • 42
  • 140
  • 295
1 2 3 4
5