ssh2

phpseclib SSH2 write not executing long command

狂风中的少年 提交于 2020-01-06 06:30:15
问题 I am trying to execute an SSH command to a device (firewall). Command is executed when the length is short. When the length is about 1000 characters, command is not being executed. When I execute the command via putty, that is working as well. After reading few solutions, I tried to set timeout to 5 seconds. Still, no help. In the device logs, I can see SSH login and logout. But no activity. I am using phpseclib ssh version 2.0 $ssh = new SSH2(ip_address); $ssh->login($user, $password); $ssh-

Can't create symlink with ssh2_sftp_symlink

让人想犯罪 __ 提交于 2020-01-06 05:41:07
问题 I'm trying to create a symlink with ssh2 but it's fails. The directory has been created (/home/test/) but the symlink doesn't. Can I debug why the symlink fails? $connection = ssh2_connect('localhost', 22); ssh2_auth_password($connection, 'user', 'pass'); $sftp = ssh2_sftp($connection); $result = ssh2_sftp_mkdir($sftp, '/home/test'); var_dump($result); $result1 = ssh2_sftp_symlink($sftp, '/home/csgo/*', '/home/test'); var_dump($result1); I'm tried with var_dump and got the following: bool

node.js connection error ECONNRESET on remote windows ssh

二次信任 提交于 2019-12-25 01:17:16
问题 I installed openssh on my remote windows server and tested it with putty.Now I want to connect to remote server through node.js , hence installed one package "simple-ssh". This package is also working fine with remote linux server but throws error with windows server. here is my code file, var SSH = require('simple-ssh'); var ssh; ssh = new SSH({ host: 'XXX.XXX.XX.101', user: 'username', pass: 'password' }); var command = 'typeperf "\\Processor(_Total)\\% Processor Time"' console.log('command

How do I download directory with all files and folders inside using npm module ssh2 for nodejs?

萝らか妹 提交于 2019-12-08 05:02:50
问题 I am trying to download files and folders via SFTP to my local machine.I am using the below code and am able to download the files in a particular directory but am unable to download the folders(with their respective files and folders recursively) in the same directory const folderDir=moment().format('MMM YYYY/D'); const remoteDir = '/var/www/html/view'; const remoteDir = 'Backup'; const download=(remoteDir,folderDir,FolderName)=>{ conn.on('ready', function() { conn.sftp((err, sftp) => { if

How do I download directory with all files and folders inside using npm module ssh2 for nodejs?

三世轮回 提交于 2019-12-07 23:36:29
I am trying to download files and folders via SFTP to my local machine.I am using the below code and am able to download the files in a particular directory but am unable to download the folders(with their respective files and folders recursively) in the same directory const folderDir=moment().format('MMM YYYY/D'); const remoteDir = '/var/www/html/view'; const remoteDir = 'Backup'; const download=(remoteDir,folderDir,FolderName)=>{ conn.on('ready', function() { conn.sftp((err, sftp) => { if (err) throw err; sftp.readdir(remoteDir, (err, list) => { if (err) throw err; let count = list.length;

JSch:纯JAVA实现远程执行SSH2主机的SHELL命令

淺唱寂寞╮ 提交于 2019-11-29 18:22:43
上篇文章我编写了利用JSch实现SFTP的文件上传和下载 http://my.oschina.net/hetiangui/blog/137357 ,在本篇文章中,我将描述如何利用JSch实现执行远程SSH2主机的SHELL命令,不说了,直接上代码和详细的代码说明: /** * 利用JSch包实现远程主机SHELL命令执行 * @param ip 主机IP * @param user 主机登陆用户名 * @param psw 主机登陆密码 * @param port 主机ssh2登陆端口,如果取默认值,传-1 * @param privateKey 密钥文件路径 * @param passphrase 密钥的密码 */ public static void sshShell(String ip, String user, String psw ,int port ,String privateKey ,String passphrase) throws Exception{ Session session = null; Channel channel = null; JSch jsch = new JSch(); //设置密钥和密码 if (privateKey != null && !"".equals(privateKey)) { if (passphrase != null