-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssh connection fails in Mac #238
Comments
Can you provide more details? Node version? ssh2 module version? Can you show the relevant code you're using? |
Thanks for the quick response. Please see version details below Node v0.11.13, [49611:0302/130216:INFO:CONSOLE(49)] ""Connection :: banner _ws \n WARNING !!! READ THIS BEFORE ATTEMPTING TO LOGON !!!\n\n This System is for the use of authorized users only. Individuals using\nthis computer without authority, or in excess of their authority, are subject\nto having all of their activities on this system monitored and recorded by\nsystem personnel.\n\n In the course of monitoring individuals improperly using this system, or\nin the course of system maintenance, the activities of authorized users may\nalso be monitored. Anyone using this system expressly consents to such\nmonitoring and is advised that if such monitoring reveals possible criminal\nactivity, system personnel may provide the evidence of such monitoring to law\nenforcement officials.\n\n Cisco Acceptable Use Policy:\nhttp://wwwin.cisco.com/infosec/policies/acceptable_use.shtml\n\n"", source: app://apollo/sa/components/session/ssh2-adaptor.js (49) see code snippet below var connectionProperties = {
host: this._host,
port: this._port,
username: this._username,
password: this._password,
readyTimeout : 60000,
keepaliveInterval : 600000
};
this._ws.on('banner', function(msg, lng) {
console.log('Connection :: banner _ws '+msg );
}).on('ready', function() {
console.log('Connection :: ready _ws Object:'+self._ws );
console.log('connected and got new WS for SSH2 in ONOPEN ');
self._state = 'connected';
self._ws.shell(function(err, stream) {
if (err) {
throw err;
}
stream.on('exit', function(code, signal) {
self._state = 'disconnected';
console.log('Stream :: exit :: code: ' + code + ', signal: ' + signal);
}).on('close', function() {
console.log('Stream :: close');
}).on('data', function(data) {
self._onWsMessage(data);
}).stderr.on('data', function(data) {
console.log('Device Std Err : ' + data);
});
self._ws.stream=stream;
});
return self._onOpenWs();
}).on('error', function(err) {
console.log(' ssh2adaptor ERROR : ' + err);
e = err;
self._state='disconnected';
self._onDisconnect(1);
}).on('debug', function(message) {
console.log('ssh2 adaptor DEBUG : ' + message);
}).on('close', function(hadError) {
console.log(' ssh2 adaptor CLOSE hadError : ' + hadError);
self._state='disconnected';
self._onDisconnect(1);
}).connect(connectionProperties); |
Can you please try with the latest ssh2 version (v0.4.4 as of this writing)? |
sure. I just did. now the banner event is not triggered and authentication still failed 81648:0302/134610:INFO:CONSOLE(93)] ""this._ws object after connection [object Object]"", source: app://apollo/sa/components/session/ssh2-adaptor.js (93) |
Bumping this. Having the same issue when using node v0.12.0 and a privateKey property. I get "Error: All configured authentication methods failed" |
@green-arrow OS X also or ? |
@mscdex OS X Yosemite |
Can both of you set |
Gist with debug: https://gist.github.com/green-arrow/2b343ec379bc73e8ab8d |
@green-arrow Ok, so you're using |
@mscdex I'm fairly positive, yes. I am able to use that private key to normally |
Gist - https://gist.github.com/mkondath/1b209b7410c84891ceb5
Thanks
From: Brian White <notifications@github.com<mailto:notifications@github.com>>
Reply-To: mscdex/ssh2 <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Sunday, March 15, 2015 at 12:19 PM
To: mscdex/ssh2 <ssh2@noreply.github.com<mailto:ssh2@noreply.github.com>>
Cc: Madhu Kondath <kmadhu@cisco.com<mailto:kmadhu@cisco.com>>
Subject: Re: [ssh2] ssh connection fails in Mac (#238)
debug: console.log
|
Ok so the problem here is that OS X (by default) does not use the "normal" password authentication mechanism, it uses the generic So you can do something like this: // ...
client.on('keyboard-interactive',
function(name, instructions, instructionsLang, prompts, finish) {
// Pass answers to `prompts` to `finish()`. Typically `prompts.length === 1`
// with `prompts[0] === "Password: "`
finish(['mypassword']);
}).on('ready', function() {
// ...
}).connect({
host: '192.168.100.27',
port: 22,
username: 'myusername',
tryKeyboard: true // this attempts keyboard-interactive auth
}); |
Great. That worked Thank you From: Brian White <notifications@github.commailto:notifications@github.com> .on('keyboard-interactive', |
@mkondath Thanks for the confirmation. @green-arrow If you're still running into the problem you described, can you open a new issue as it seems unrelated to the original issue. Also if you can enable full debug output on the server-side and post that in the new issue, that would be helpful in determining what the server is seeing. |
I'm actually using another library which uses |
I had the same issue. the tryKeyboard works for me on OSX El Capitan Thanks very much for the solution |
Hi! @mscdex I know this issue is supposed to be solved, but I got again exactly the same problem. I'm using v 0.5.4 of SSH2 in a MacOS running Sierra 10.12.2, and if I don't enable the Otherwise, the library just warns that all the authentication systems have been used and it's quite confusing the debugging! Also, tools depending on this library such as open-ssh-tunnel or electron-tunnel do not work in MacOS either! Otherwise, thanks a lot for this amazing library! |
Hi all, I too can confirm that this is still occurring as per @Sturgelose's comment. Using v0.5.4 of ssh2 and on El Capitan. The Cheers and great work on this library! |
I think this "problem" is best handled by 3rd party modules that use this module, because at this level I don't want to be making any decisions/assumptions about any keyboard-interactive prompts and how they should be handled. macOS seems to be the most common platform that uses keyboard-interactive (only?) by default out of the box, but technically the same issue will be had with any other server that has a similar setup. The same could be said about other authentication configurations (e.g. "why can't my 2fa be automatically supported by ssh2?" or similar questions). |
I could connect to my Mac using command line but it fails using ssh2 Node module
ssh2adaptor ERROR : Error: Authentication failure. Available authentication methods: publickey,keyboard-interactive"", source: app://apollo/sa/components/session/ssh2-adaptor.js (79)
OSX Version10.9.4
Let me know if you need more details
Thanks
The text was updated successfully, but these errors were encountered: