6

I just started using Remote - SSH (ms-vscode-remote.remote-ssh) plugin. I put this code into settings.json:

    "remote.SSH.remotePlatform": {
        "myserver": "linux"
    }

In the config file:

Host myhost
  HostName myhost
  User root
  IdentityFile ~/.ssh/id_rsa.pub

Exactly as the documentation said, and I expected - like in the PuTTY - the plugin just log in and done, but it still asking password for login.

Is there any setting what I missed? Or is there any setting what I must apply to avoid asking password?

3 Answers 3

3

You need to use the private key as mentioned below. Additionally, you need to copy the contents of your public key file (the one that ends with .pub), to a file called "authorized_keys", usually located under ~/.ssh

Sign up to request clarification or add additional context in comments.

2 Comments

Different SSH clients and servers use different methods for storing their public and private keys, and whenever I need to set up some client/server pair, I need to find out how/where to store the keys. In this case, connecting a VSCode on a Windows machine to a server on a SLES machine (with the particular SSH server my company uses), this answer's location for the private key on the server was what saved the day. Thanks.
My public key is already added to authorized_keys, but still nothing.
2

For Windows 10, if you have stumbled across this issue using the Remote - SSH plugin, run the following in PowerShell (as admin):

# Make sure you're running PowerShell as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent

And then if you already generated a key, do ssh-add. It should then prompt you for the passphrase of your key, then you should get a message that your key has been set as the default identity. Open up VSCode and try again.

Comments

1

You are supposed to use the private key, if your public key is ~/.ssh/id_rsa.pub then the private key is probably ~/.ssh/id_rsa

1 Comment

I just modified as you suggested, but still asking password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.