vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Requires correct file permissions on key file but freezes if incorrect

Open cfsmp3 opened this issue 7 years ago • 8 comments

Nothing special (same as the command line SSH client) but it provides no feedback. With the SSH key file being a regular (I mean, with the typical default Windows permissions, with inheritance on, etc), the command line SSH does this:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'XXXX.key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "XXX.key": bad permissions

And well, it completely refuses to connect until it really likes the permissions (basically - disable access direct or indirect (inheritance) to anyone other than the owner).

The extension replicates this behavior, but instead of displaying a message, it just stays on "Confirming that remote is connectable..." forever.

cfsmp3 avatar Oct 05 '19 18:10 cfsmp3

I met the same problem, which stopped me from connecting to the server without typing password.

QQQYang avatar Oct 14 '19 10:10 QQQYang

Turns out we need to put the private key under %USERPROFILE% (C:\Users\jeremy in the following case). I successfully connect to my remote server with the key file with a config file like this:

Host [IP_ADRESS]
  HostName [IP_ADRESS]
  User [username]
  Port [port]
  IdentityFile "C:\Users\jeremy\.ssh\id_rsa"

I created the key pair in WSL and moved the private key file to C:\Users\jeremy\.ssh\id_rsa.

JeremyCCHsu avatar Oct 14 '19 23:10 JeremyCCHsu

I just move local private key from C:\Users\XXX\.ssh\ to C:\Users\XXX, then everything goes well. Now, I can password-free login in the server by remote ssh.

QQQYang avatar Oct 15 '19 03:10 QQQYang

This is really annoying and should be fixed. In the meantime I confirm creating a separate directory with arbitrary name suffices.

Put the config file and the private ssh key files into that directory and adapt paths in the config file accordingly, e.g.

Host my-machine.westeurope.cloudapp.azure.com
    HostName my-machine.westeurope.cloudapp.azure.com
    IdentityFile C:\Users\werle\ssh_for_vscode_azure\some-user.pem
    User some-user

Then click in the lower left corner on the >< sign and choose "Open Configuration File", then point to the config file in that folder. image

daixtrose avatar Aug 21 '20 09:08 daixtrose

On Windows 10 managing permissions from a file solved the issue for me after I only granted read permissions to my user.

Right click on the file, Properties->Security->Advanced Click on Disable Inheritance Click on Add and grant your Windows user read permissions

siran avatar Jan 15 '21 14:01 siran

Had the exact same error after a migration of my laptop from work, what i've found at, is that on my personal folder C:/User/myself there was an other account which had access. I removed it, leaving me, System, and Administrator only to have access rights to my folder, and the error went away after deleting this unknown account (which i suspect was used to migrate my data from my older laptop to my new one.)

jmnguye avatar Feb 01 '21 14:02 jmnguye

Still got the error ( Permission denied (publickey).> The process tried to write to a nonexistent pipe.) with the solution by @siran. Solution:

After "Click on Disable Inheritance", choose "Convert ..." instead of "Remove all permission..."; then edit, and remove other users (my case: Account Unknown-SID).

Ashok314 avatar May 19 '22 03:05 Ashok314

I believe we handle bad permissions better now (you will still need to fix permissions yourself)

roblourens avatar Dec 16 '22 23:12 roblourens