Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: private key authentication help

$
0
0
Attempting to authenticate via username and privatekey only but all examples i can find seem to include in the authenticationMethod[] both a PasswordAuthenticationMethod (which i dont want to use and cant provide the pw for users) and the privateKeyAuthenticationMethod()

if i take out the PasswordAuthenticationMethod i get an exception for no such authentication method

if i leave it in and pass in no password just "", as i stated previously getting the password from users is not an option the authentication fails. It would seem that the PasswordAuthMethod is being tried and fails and then doesnt try the key method? Is this correct, or does it try both methods?

Again what i need to do is authenticate with a private key and a username. I do not want to pass in a username, password combo.

Is there some way to accomplish this?

here is what i am doing now.
     Renci.SshNet.ConnectionInfo conn = new ConnectionInfo(hostName, port, username, new AuthenticationMethod[]
            {
                new PasswordAuthenticationMethod(username, ""), 
                new PrivateKeyAuthenticationMethod(username, new PrivateKeyFile[] { new PrivateKeyFile(privateKeyLocation, "") }),
            });

            using (var sshClient = new SshClient(conn))
            {
                sshClient.Connect();


Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>