From c4f85db8d8fa7c185ed2729ce713f8e8bdd863b9 Mon Sep 17 00:00:00 2001 From: Dave Eddy Date: Tue, 1 Sep 2015 10:16:42 -0400 Subject: [PATCH] support for `triton ssh user@id` --- lib/do_ssh.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/do_ssh.js b/lib/do_ssh.js index 5f97ca4..5f0b492 100644 --- a/lib/do_ssh.js +++ b/lib/do_ssh.js @@ -19,6 +19,14 @@ function do_ssh(subcmd, opts, args, callback) { } var id = args.shift(); + + var user = 'root'; + var i = id.indexOf('@'); + if (i >= 0) { + user = id.substr(0, i); + id = id.substr(i + 1); + } + this.triton.getInstance(id, function (err, inst) { if (err) { callback(err); @@ -31,7 +39,7 @@ function do_ssh(subcmd, opts, args, callback) { return; } - args = ['-l', 'root'].concat(ip).concat(args); + args = ['-l', user].concat(ip).concat(args); self.triton.log.info({args: args}, 'forking ssh'); var child = spawn('ssh', args, {stdio: 'inherit'});