SwiftSH
SwiftSH copied to clipboard
Authenticating with Public/Private key
Not really an issue I guess, more an open question:
I'm trying to open a shell with an RSA key, but I can't quite follow the code to see how that's done. Am I right in believing I should be using the authorise() method? The challenge seems to accept public/private keys, but I can't figure out how.
I'm trying the following:
self.authenticationChallenge = .byPublicKey(username: self.username, password: self.password, publicKey: self.publicKey, privateKey: self.privateKey)
But I get this response:
DEBUG: Timeout set to 10.0 seconds
INFO: Libssh2 v1.8.0
DEBUG: ec2-54-77-251-54.eu-west-1.compute.amazonaws.com resolved. 1 addresses
WARN: Connection to 54.77.251.54 on port 22 failed
INFO: Bye bye
DEBUG: Disconnected
The username and keys are hardcoded and work fine using vanilla NSSH (but I can't get that shell to work). There is however no password, just an empty string. Could that create this issue? How can I debug the challenge?
Strangely, this code actually does work. But only 1 out of 3 times. No idea why as I'm unsure how to debug.
I had a similar issue which was caused by a very short timeout creating the connection. See PR https://github.com/Frugghi/SwiftSH/pull/28.