7

Can I use the "Vscode remote SSH" extension without a password? I have a Linux server, my public key in the server and I know the username and the IP address. also, I'm able to ssh to the server using the terminal.

** Is there any way to achieve that?

Mustafa
  • 73
  • 1
  • 1
  • 5

1 Answers1

8

Put something similar to your "C:\Users\yourhome\.ssh\config" that is known by vscode. I think "PreferredAuthentications" line is most important one.

Host vscode
    HostName 192.168.0.1
    User linuxusername
    PreferredAuthentications publickey
    IdentityFile "C:\Users\yourhome\.ssh\privatekey"
Jarivaa
  • 96
  • 3
  • Whenever the "PreferredAuthentications" line exists, I am getting an error message "Could not establish connection to hostname: The process tried to write to a nonexistent pipe." ? – aviator Jan 27 '21 at 18:09
  • 2
    Resolved! I was trying to point IdentityFile to a PuTTy (.ppk) file instead of OpenSSH format (no extension). I wish the error messages were more helpful though :/ – aviator Jan 27 '21 at 18:18
  • This is how I got locked out of my server :(. Now I just get the error: "Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive)." – joshkarges Apr 29 '22 at 18:28
  • If you get locked out, be sure that you added the public key with `ssh-copy-id {user}@{host}` BEFORE setting `PreferredAuthentications publickey`. If you didn't, just delete the line in the config file temporarily then readd it once you copy the public key over. – Kyle Carow Aug 05 '22 at 14:31