Save time managing and deploying your node.js app

Nodejitsu has joined GoDaddy

We are excited to join GoDaddy to help spearhead their largest Node.js product: Website Builder. Please read our blog post to learn more about customer transition plans and our continued support for Open Source within the node community.

Want to know all the details?
Read the full blog post or read the GoDaddy Announcement.

npmawesome: simple SSH interface with sequest

About the author

nodejitsu nodejitsu

Other popular posts

- Scaling Isomorphic Javascript Code - Keep a node.js server up with Forever - Package.json dependencies done right
- npm cheat sheet - 6 Must Have Node.js Modules

This is a guest post from Alex Gorbatchev over at Nodejitsu loved what was doing and is now supporting the project.

sequest (GitHub: mikeal/sequest, License: MIT) by Mikeal Rogers is a simplified interface to the ssh2 (GitHub: mscdex/ssh2, License: MIT) that was featured earlier. It provides a simplified approach on top of the stream based interface.

For example, each command will complete before the next is sent to the server. If any command returns a non-zero exit code sequest will emit an error which effectively ends the stream and the processing of subsequent commands. This allows you to use sequest in a more serial fashion and not have to worry about handling all the pesky stream events. sequest brings in shortcuts to execute a command as well as put and get files remote files.

npm install sequest  


By default sequest will use your local ssh-agent to authenticate to remote hosts which should make it unnecessary to enter username, password or private key information. So at the bare minimum, sequest code looks like this:

var sequest = require('sequest');

sequest('root@', 'ls', function (err, stdout) {  
  if (err) throw err;

My fully functional example on runnable looks like this:

var sequest = require('sequest');  
var fs = require('fs');

var opts = {  
  command: 'ls -la', 
  privateKey: fs.readFileSync('/root/.ssh/id_rsa')

sequest('test_user@', opts, function (err, stdout) {  
  if (err) throw err;

What Else?

Checkout the runnable example and github example repository.