My system admin created a new droplet on digital ocean, and provided me with root username and password and a public key txt file. when i try to access:

PS C:\Users\Simou> ssh root@x.x.x.217

I get this:

root@x.x.x.217: Permission denied (publickey).

since i'm used to powershell, i don't like using putty, even that putty provides the way to add a public ssh key. I think the problem is that i need to add that ssh key somewhere (saw that linux users do that), but i don't know how to do it in powershell, and i don't find any solutions when searching, because all of the result is about generating a private/public pair and putting my public on the server, but my case is the inverse of that. i must put the servers public on my powershell. any help is appreciated.

  • @Moab i have seen this already, and followed it, but when i do: PS C:\Users\Simou> ssh-add ./.ssh/VPS-kep Error loading key "./.ssh/VPS-kep": invalid format – Wassim Chaguetmi Sep 15 at 8:51
  • Its good to know what you have tried. – Moab Sep 15 at 12:43
  • @WassimChaguetmi .... I thought with key pair authentication the "public" key always goes on the server for the public keys the server admin configures as such as says to allow these public keys, and the client that shared the public key which the server admin added to be authorized for access will authenticate to connect to that server assuming the client has it's own private key. Only the connecting client will have its private key, the server only needs the public key so the "inverse" isn't for ssh key pair authentication perhaps I don't believe. – Pimp Juice IT Sep 15 at 19:55
  • Please expand on this "inverse" configuration which you are exploring and send a link or something you are reading about this sort of configuration. Perhaps there's something I don't understand but I'm not certain it works that way with ssh key pair authentication. I'm not an expert SSH guru though so perhaps I need to read over this configuration methodology or whatever you are trying to get to work. Feel free to share such detail and/or resources. I'm curious what happens if you use the private key though. – Pimp Juice IT Sep 15 at 19:58

You are not connecting with PowerShell. You are connecting with OpenSSH ssh.

So you configure your private key the same way as with OpenSSH on Linux. If you generate your key pair with ssh-keygen, it gets automatically stored to the right place, where ssh fill find it: .ssh folder in your Window profile in %USERPROFILE%, i.e. typically in C:\Users\username\.ssh.

As others have commented, you cannot authenticate with server's public key. Hard to tell what you got actually. But it might be a server's host key, which you are supposed to use to verify that you are connecting to the correct server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.