2

So I've got myself a new computer. Lucky me. Win 10 Pro.

But SSH is not my strong suit. I can login to my remote server via the command line using:

ssh username@myserver.com

Promted for password - straight in.

I've moved my .pub files and the config file from the .ssh directory of my old computer to to my new computer But VScode will not login. I've used ssh-keygen to create a new key and added it to .ssh/authorized_keys on the server. No login. I just keep getting:

Load key "C:/Users/myuser/.ssh/key.pub": Permission denied

What am I missing here? I've been through the process enough times to make sure there are no spelling mistakes. Everything still works on my old computer.

EDIT:

To set up the ssh key I:

ssh-keygen -t rsa -b 4096 -f %USERPROFILE%/.ssh/pub_rsa

Then:

scp -p 22 %USERPROFILE%/.ssh/pub_rsa.pub username@server.com:~/

And finally:

cat ~/pub_rsa.pub >> ~/.ssh/authorized_keys

... and of course chmod that file to 600.

ssh -i %USERPROFILE%/.ssh/pub_rsa -p 22 username@server.com

... logs in fine without being prompted for a password. My remote-ssh config file looks like:

Host my_remote
    HostName server.com
    User username
    Port 22
    IdentityFile C:/Users/MyDir/.ssh/pub_rsa.pub 

EDIT2: If I remove the .pub from the last line of the IdentityFile, I get this error message and VScode just repeats itself failing to log on --> enter image description here

Jonas__G
  • 175
  • 2
  • 12
  • Please [edit] your question to describe in detail what you did to set up this ssh key on the server and in vscode. – Kenster Aug 09 '20 at 15:54
  • I've tried to explain mye process now, @Kenster. Also trying to remember what else Ive tried - cause the post is probably not complete in that sense either. – Jonas__G Aug 09 '20 at 16:31
  • `IdentityFile C:/Users/MyDir/.ssh/pub_rsa.pub` https://stackoverflow.com/a/29948797/13317 – Kenster Aug 09 '20 at 16:57
  • Tried that, @Kenster. Edited original post to reflect that. – Jonas__G Aug 09 '20 at 19:09

2 Answers2

1

Rolled back remote-ssh to version 0.49 - and that seems to have done the trick. Check this post for similar problem/solution.

Jonas__G
  • 175
  • 2
  • 12
0

First, I confirm a ssh config file would always reference the private key (in your case pub_rsa), not the public key.

Second, regarding the flock error message, check microsoft/vscode-remote-release issue 1896

  • find settings: Remote.SSH: Lockfiles In Tmp
  • check it

(seen also in issue 2059, make sure to use the latest VSCode release)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Unfortunatly, my remote.ssh: Lockfiles in Tmp was allready checked. And I have the latest release (new computer, new software - no available updates). So check on all three - but still same issue. – Jonas__G Aug 10 '20 at 19:01