Which is odd. I tried to change the permission using the 'chmod' command, but that didn't seem to work. The bash gave the impression that the command registered, but I checked the permissions of the key and it was still at 777. I opened my git bash and I was able to ssh into my instance with no problem, and the permissions were not 777 as well.

2 Answers
2

If you're referencing files in the Windows file system, they do not, by default, retain Linux permissions.
However, there's a way to enable that. Edit or create (using sudo) /etc/wsl.conf and add the following:

[automount]
options = "metadata"

Shut down all WSL instances and restart an instance, and any chmod changes are now retained.

Is the private key on your Windows filesystem (under /mnt/)? You can't modify the permissions of files on Windows's filesystem using chmod on Bash on Ubuntu on Windows. You'll have to copy the private key to your WSL home directory (~) and do it there.

There are at least 3 pages to that discussion. You really should quote the information you feel is relevant to the author.
– RamhoundMay 17 at 18:23

1

The thing was that perviously, I was able to ssh into my instance with no problem. This only started happening today
– iiiMay 17 at 18:42

1

@iii So what changed recently? Did you install any windows updates? Did you change any config files? Please edit and update your question.
– DavidPostill♦May 17 at 18:53

1

@iii - Which update? Your question makes no reference to the fact it was working previously. Your question also makes no reference that you recently installed an update. I disagree with this answer, because the link is from before WSL was modified (I believe), to support what you are trying to do. Which is the reason I was pressing the author to elaborate thier answer
– RamhoundMay 17 at 19:09

2

@Ramhound, the relevant information from that discussion is paraphrased in my answer, I just added that link as a reference source. The relevant information is in the first reply there. I didn't know that the questioner only encountered this problem after a Windows update, but they haven't said whether the key is on the Windows filesystem, so I still think that's the most likely explanation until they indicate otherwise.
– erobertcMay 17 at 21:30