Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH key permission denied on Docker container as remote in VSCode #1

Closed
shriv opened this issue Jul 27, 2021 · 1 comment
Closed

SSH key permission denied on Docker container as remote in VSCode #1

shriv opened this issue Jul 27, 2021 · 1 comment

Comments

@shriv
Copy link

shriv commented Jul 27, 2021

Hiya,
I'm following your excellent guide on connecting to a development docker container on VSCode. Unfortunately, I keep getting the following error

[13:14:05.372] > root@localhost's password:
[13:14:05.373] Showing password prompt
[13:14:08.982] Got password response
[13:14:08.982] "install" wrote data to terminal: ""
[13:14:08.997] >
[13:14:09.005] > Permission denied, please try again.

The requirements of WSL2, OpenSSH (on Windows) and VSCode (with remote extensions plugin) are all satisfied. I tried creating SSH keys on WSL with and without passwords and both fail with the same error. My version of VSCode is 1.58.2.

If you have any suggestions, that would be great!

cheers,
Shrividya

@shriv shriv changed the title Docker container as remote in VSCode SSH key permission denied on Docker container as remote in VSCode Jul 27, 2021
@cmhh
Copy link
Owner

cmhh commented Jul 28, 2021

Hi Shriv

Sorry, I didn't get an email notification and didn't see this issue till just now.

It definitely seems the ssh keys don't match, since the whole point was to avoid the use of a password. If you're sure you're copying the keys out of ~/.ssh in your WSL2 distro then it should work. One way to check would be to connect to the container from the WSL2 terminal and then check the environment variables. So:

docker exec -it <name of container> /bin/bash

will get you to the terminal of the development container, and then you can just do:

echo "$PUB_KEY"

and

cat ~/.ssh/authorized_keys

These should match, and they should also match the contents of ~/.ssh/id_rsa.pub in your WSL2 distro. Note that vscode has extensions specifically for connecting to containers which might be a bit more streamlined, but I've not tested it out yet. Perhaps I'll update that post after I've tested it out.

@cmhh cmhh closed this as completed Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants