4

I'm trying to format a .pem file for access to an EC2 instance through SSH, but no matter what I try among suggestions I've seen, nothing seems to work. For context, I have the .pem file stored on my Windows C:// drive.

From just downloading it, I get the following permissions as seen in my WSL shell (and output of ssh command, fails, obviously): enter image description here

The following are my attempts to modify this file

  1. Used Ubuntu's WSL to chmod the file into 400 (what I assume is -r--------): (forgot to unhide my username, lol) enter image description here

1.a. I have modified my wsl.conf with the following to make sure to allow permissions changes to propagate from my WSL shell (Unable to change file permissions on Ubuntu Bash for Windows 10):

enter image description here

  1. Used Powershell to try to place restrictions on the file (https://stackoverflow.com/questions/39404087/pem-file-permissions-on-bash-on-ubuntu-on-windows): enter image description here

Now, permissions are `-r--r--r--', which still isn't good enough.

enter image description here

  1. Made sure the file is only readable by user in Windows settings (Windows SSH: Permissions for 'private-key' are too open):

enter image description here

What else can I do here? This is literally all the answers I've found online and they don't work. Any help is appreciated. Thanks y'all!

EDIT: After some reading, it seems that Powershell has some extra ways to reset permissions but I can't seem to find any definitive source.

Daneolog
  • 491

1 Answers1

5

WSL will start in your C:\Users{user} directory.

Put the file in /home/{user}, then change the permissions.

Alymsin
  • 106