ssh2-exec

Why commands with ssh2_exec do not end?

雨燕双飞 提交于 2019-12-13 07:17:55
问题 I have a problem running a command on my server remotely with ssh2_exec. When I use wget or unzip, the command should execute but I get no result or only a few files. What I need to know is how I can be sure that my ssh2_exec script will execute fully before proceeding to the rest of my PHP code. $stream =ssh2_exec($connection, 'cd /home; wget http://domain.com/myfile.zip; unzip myfile.zip; rm myfile.zip'); Thanks in advance! EDIT : I have found script, how get result of commands ? <?php $ip

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

余生长醉 提交于 2019-12-06 14:05:33
问题 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: require('fs').readFileSync('privateKey/file.pem'), passphrase:''}; var hosts = [ '54.xxx.xxx.xxx' ]; var cmds = [ 'sudo adduser testuser' ]; rexec(hosts, cmds, connection_options, function(err){ if (err) { console.log(err); } else { console.log('Great Success!!'); } }); It returns the error :

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

谁说胖子不能爱 提交于 2019-12-04 19:24:41
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: require('fs').readFileSync('privateKey/file.pem'), passphrase:''}; var hosts = [ '54.xxx.xxx.xxx' ]; var cmds = [ 'sudo adduser testuser' ]; rexec(hosts, cmds, connection_options, function(err){ if (err) { console.log(err); } else { console.log('Great Success!!'); } }); It returns the error : [Error: 554.xxx.xxx.xxx : sudo adduser testuser [Exit 1]] sudo: sorry, you must have a tty to run sudo

Installing ssh2 on xampp

徘徊边缘 提交于 2019-11-28 10:48:49
问题 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 c:\xampp\php\ext ) folder; remove ; from this line extention:php_ssh2.dll in php.ini. restart xampp But I am getting error in log file: unable to load dynamic library php_ssh2.dll Can anyone help me with this? 回答1: A couple of things you may have missed