node-ssh | A hookable ssh server for node.js using libssh | SSH library
kandi X-RAY | node-ssh Summary
kandi X-RAY | node-ssh Summary
Create ssh servers in node.js!.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of node-ssh
node-ssh Key Features
node-ssh Examples and Code Snippets
Community Discussions
Trending Discussions on node-ssh
QUESTION
I have a Node API deployed to Google CloudRun and it is responsible for managing external servers (clean, new Amazon EC2 Linux VM's), including through SSH and SFTP. SSH and SFTP actually work eventually but the connections take 2-5 MINUTES to initiate. Sometimes they timeout with handshake timeout errors.
The same service running on my laptop, connecting to the same external servers, has no issues and the connections are as fast as any normal SSH connection.
The deployment on CloudRun is pretty standard. I'm running it with a service account that permits access to secrets, etc. Plenty of memory allocated.
I have a VPC Connector set up, and have routed all traffic through the VPC connector, as per the instructions here: https://cloud.google.com/run/docs/configuring/static-outbound-ip
I also tried setting UseDNS no
in the /etc/ssh/sshd_config file on the EC2 as per some suggestions online re: slow SSH logins, but that has not make a difference.
I have rebuilt and redeployed the project a few dozen times and all tests are on brand new EC2 instances.
I am attempting these connections using open source wrappers on the Node ssh2 library, node-ssh and ssh2-sftp-client.
Ideas?
...ANSWER
Answered 2020-Dec-12 at 21:23Cloud Run works only until you have a HTTP request active.
You proably don't have an active request during this on Cloud Run, as outside of the active request the CPU is throttled.
Best for this pipeline is Cloud Workflows and regular Compute Engine instances.
You can setup a Workflow to start a Compute Engine for this task, and stop once it finished doing the steps.
I am the author of article: Run shell commands and orchestrate Compute Engine VMs with Cloud Workflows it will guide you how to setup.
Executing the Workflow can be triggered by Cloud Scheduler or by HTTP ping.
QUESTION
Here I'm trying to run node file in AWS server with the ssh command through the shell script, where inside the shell file there is a command to run node file (node test.js)
Executing the below command, will run the shell file inside AWS server
...ANSWER
Answered 2020-Jun-08 at 07:27Thanks to ROOT
Add the node path while running the node file. The response of which node
will be add to run the node file.
QUESTION
I want to use this npm package(https://www.npmjs.com/package/node-ssh) in my nw.js application, In my dev system installed node js and installed this package and successfully its working , But while shipping this application I don't want to make a dependency to node js. Without installing the node js can nw.js use this package.
Any help ?
...ANSWER
Answered 2020-Jan-30 at 02:45Use Gradle wrapper and the Gradle Plugin for Node.
To avoid having to install gradle, I use Spring Initializr to create a simple project that has the gradle wrapper in it. Then I'll just copy the gradle
folder, the gradlew
and gradlew.bat
. All that's left then is to create the .gitignore
and build.gradle
files.
QUESTION
I am trying to do some automation scripts via node-ssh but it behaves in a very strange way:
When I am using classical ssh (via terminal or vs code) node version is 10.16.3 and NVM command is available:
...ANSWER
Answered 2019-Dec-10 at 02:34I have figure out the problem: https://www.digitalocean.com/community/questions/node-v-and-nodejs-v-different-output
It can be solved by installing node.js from official Ubuntu packages not via NVM. https://github.com/nodesource/distributions#debinstall
QUESTION
I need to generate a rsa key pair on node js
code in order to use it with an openssh
client on an docker
container.
I'm using the generateKeyPair function of crypto
to generate keys and parse[Private]Key
of sshpk to translate keys from pem
to openssh
format.
ANSWER
Answered 2019-Oct-07 at 18:03The problem was really the key of the host, not the generated keys.
But the "clean" method doesn't work :
QUESTION
I need to download some .txt.pgp
files from sftp
. I've tried npm ssh2
, ssh2-sftp-client
and node-ssh
without any success.
The closest I got so far is the list of the files in the remote folder using sftp.readdir
(ssh2
) or sftp.list
(ssh2-sftp-client
).
I've tried pipe
and fs.createWriteStream
and sftp.fastGet
but there's no file saved on my local machine.
ANSWER
Answered 2018-Nov-01 at 21:20Regarding your first attempt (with the ssh2
module), there are three issues that I can see:
- You are calling
conn.end()
outside of a series of preceding async functions, which is almost definitely causing the SSH session to close before you've finished downloading the files. - You are not providing the
sftp.fastGet()
function with the correct path to the remote file. Earlier in the code, you callsftp.readdir()
with the remote directory argument'out'
, which returns a list of files relative to the remote directory. (Point is: you need to prepend the remote directory to the file name to create a correctly qualified path.) - You're not handling the stream event
error
, so I suspect you're not getting useful error messages to help troubleshoot.
Try something like:
QUESTION
sampleGroupOfStores is an array of 100 objects
The console logs inside the map show things correct
but console.log(storeResults) is just an array of 100 undefined items
I think I'm not returning things correctly here inside map to make the new array of objects storeResults.
Any tips would be greatly appreciated.
i removed any sensitive data from the script below
I was using .forEach but I decided .map is what I wanted because I want to take sampleGroupOfStores and get a new array of objects out of it based on the criteria in the if statements below.
The setTimeOut was because I was thinking the console.log(storeReults) was running before the map fully finished.
...ANSWER
Answered 2017-Oct-31 at 18:45Looking at the code for exec(), you aren't going to get any value out of it (the result of exec()
will always be undefined
And since that result is what gets passed back out to map
to be added into the final outcome ... you're getting an array of undefined
.
It looks like you'll need to re-think your strategy so that you're updating your array from within the callback.
I tend to do as you are considering with results = []
- and then inside of callback, I use results.push(usefulValue)
When you do that, you'll want to stop using .map()
.map()
converts one array to another array by calling a method and building the output array from the responses.
So to change to using an "external" array, you'll want to use a for loop instead of .map()
QUESTION
I tried remote-exec and node-ssh packages, but both are resulting the same as mentioned below.
...ANSWER
Answered 2017-Jun-30 at 08:22Comment below line in /etc/sudoers file.
#Defaults requiretty
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-ssh
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page