-
-
Notifications
You must be signed in to change notification settings - Fork 959
Closed
Description
I'm trying to connect to an Ubuntu server with my private key, but I can't get it working
let execution () =
let connectionInfo = new ConnectionInfo(host, "root", new PrivateKeyAuthenticationMethod("./resources/keys/id_rsa"))
use client = new SshClient(connectionInfo)
do client.Connect()
()
do execution ()
The code is a F# script but I guess it's readable.
I tested the file to be reachable (looks like the exception if the path is wrong is the same) and I also tried using the key with ssh cli, succesfully. So the key should be good.
EDIT: the same error occurs using both the NuGet package and the current develop branch on GitHub
EDIT 2: i managed to get it working. This is the working code:
let execution () =
let connectionInfo = new ConnectionInfo(host, "root", new PrivateKeyAuthenticationMethod("root", new PrivateKeyFile("./resources/keys/id_rsa")))
use client = new SshClient(connectionInfo)
do client.Connect()
()
do execution ()
I see it's a bit redundant (having to specify twice the username). Is there a better way, similar to the multi-factor example?
thstarshine