libssh2

Use pty with ssh2 in node to execute command with sudo

荒凉一梦 提交于 2019-12-06 07:22:16
I need to launch a command with sudo over ssh using npm ssh2 module for node.js; only reading module's documentation I can't figure out how to use the pty option: ssh.on('ready', function() { //not working sudo command: ssh.exec('cd /var/www/website && sudo mkdir myDir', { pty: true }, function(err, stream) { if (err) throw err; stream.on('exit', function(code, signal) { console.log('exit code: ' + code + ' signal: ' + signal); ssh.end(); }); }); }).connect({ host: configuration.sshAddress, port: 22, username: configuration.sshUser, password: configuration.sshPass }); Can someone explain the

PHP extension installed but not loading

假装没事ソ 提交于 2019-12-06 01:07:34
问题 I'm trying to install php's ssh2 extension, and having a little bit of difficulty. The file is there, it's just not loading into php. First, I've installed ssh2 with: aptitude install libssh2-1-dev libssh2-php (For what it's worth, I'm running Ubuntu 12.04 on Nginx.) I can see that ssh2 is loaded using the modules command: php -m |grep ssh2 ssh2 However, when I run my code, I get an undefined function error. In my phpinfo() script, I can see that my php installation scans this directory for

How is Esc,Alt,Ctrl and arrow keys encoded in ssh/shell

非 Y 不嫁゛ 提交于 2019-12-04 19:21:23
I am making a SSH client for a special device which does not have a all keys on it's keyboard, my question is how is the Esc,Alt,Ctrl and arrow keys encoded in the string sent to the shell? is it just '\033'? I know how the Enter key behaves, it gives an ^M, from here But when i press Ctrl + v and then Ctrl nothing appears, when i press Ctrl + v and then Ctrl + c in the teminal i get: ^C , so is Ctrl just ^ ? But what about alt Further more i found: left ^[[D right ^[[C up ^[[A down ^[[B can i just write these commands as command below, to libssh: rc = libssh2_channel_write(self.channel,

Compiling libssh2 on windows

孤街醉人 提交于 2019-12-03 08:52:11
问题 Some one can help me to compile libssh2 on windows with Visual Studio 2017. The only things I found are too old and outdated. I downloaded libssh2 from github and run cmake libssh2 and then cmake -P cmake_install.cmake but can't find INSTALL file "libssh2.lib". And I'm stuck here! ******** Update 1 *********** Crypto_backend is missing, I trying to compile with openssl and get a lot of unresolved symbols. ******** Update 2 *********** Ok! I used the cmake-gui and get rid of the unresolved

ssh2_exec not executing simple command

落爺英雄遲暮 提交于 2019-12-01 06:38:05
I'm having a nightmare of a problem with ssh_exec() refusing to execute a command in Windows. Here is my code : <?php $connection = ssh2_connect('localhost', 22); ssh2_auth_none($connection, 'root'); $stream = ssh2_exec($connection, 'C:\Program Files\CCleaner\CCleaner.exe',FALSE); ?> It shows me the following warning: Unable to request a channel from remote host in . If you have any tips, please let me know. Thank you. StampyCode Firstly, it is unlikely that you are going to be able to connect to your Windows server using ssh2_connect , because SSH is not a protocol typically used to connect

phpseclib or ssh2 pecl extension

穿精又带淫゛_ 提交于 2019-12-01 06:12:26
问题 My post from yesterday: https://stackoverflow.com/questions/14296006/phpseclib-sftp-port-number Ok, so yesterday I started learning about SSH / SFTP with php. I searched a bunch of forum posts and surmised that i needed to download the phpseclib. Being relatively new to php thus starting on php5 i was not aware of previous php4's non-use of the __constructor, hence the above question/post. The responses were conflicting, and a little off topic to the original Q however has delivered me to a

ssh2_exec not executing simple command

本小妞迷上赌 提交于 2019-12-01 03:10:47
问题 I'm having a nightmare of a problem with ssh_exec() refusing to execute a command in Windows. Here is my code : <?php $connection = ssh2_connect('localhost', 22); ssh2_auth_none($connection, 'root'); $stream = ssh2_exec($connection, 'C:\Program Files\CCleaner\CCleaner.exe',FALSE); ?> It shows me the following warning: Unable to request a channel from remote host in . If you have any tips, please let me know. Thank you. 回答1: Firstly, it is unlikely that you are going to be able to connect to

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

Connect to SFTP using PHP and private key

谁说我不能喝 提交于 2019-11-27 23:46:41
问题 I have read article after article and just cannot find "the solution" that works for what I have. I am trying to upload files via SFTP using php scripting. I have connected using CyberDuck successfully, but I need to do this programatically. I have a .PPK file from the vendor that I used in CyberDuck. I have a username. I have the hostname. If I open the PPK file I see some Public Lines, Private Lines and Private-MAC. Is there anyway I can access the server to do what I need to do using the

PHP Install SSH2 on Windows machine

久未见 提交于 2019-11-26 15:26:24
I am trying to install this on a Windows+Apache machine. Documentation says that SSH2 requires the OpenSSL and libssh2 libraries. I have added this lines in my php.ini file: extension=php_openssl.dll extension=php_ssh2.dll and restarted Apache but it still not working ( Fatal error: Call to undefined function ssh2_connect() ). Can anyone explain me how to install this service? Thanks ps: i'm italian, sorry for my english... Alex B Here's how I did it: Downloaded Win32 SSH2 PECL extension from this location (choose the appropriate version); Extracted the archive's content and: placed php_ssh2