3

I am unable to change permissions to 600 on an AWS .pem file.

  • Note that "inherited permissions" were turned off in all efforts, and owner was set properly.
  1. Tried using this guide with File Explorer:
    https://stackoverflow.com/questions/5264595/windows-chmod-600
  2. Tried using this guide with PowerShell as Admin, and ICACLS:
    Windows SSH: Permissions for 'private-key' are too open
  3. Tried good ole' fashioned:
    chmod 600 with Git Bash. ng.
  4. I followed the instructions in this vid (skip to 5:17):
    https://www.youtube.com/watch?v=ZcC4Eq0a5Mw
  5. I've also tried resetting the file in an Admin Windows Powershell with:

icacls .\key.pem /T/ Q/ /C /RESET

The file stubbornly remains at permissions 644, or rw-r--r--. Since AWS requires 600 on a .pem file, this prevents me from ssh'ing into my instance.

Nothing is working! Why is this stuck? Why can't I change these permissions? Such a simple thing hanging me up and eating up time... frustrating. Ty.

2 Answers 2

1

I got in. For posterity, here's what was happening. It was a two-part problem.

  1. I am using Git Bash. On an ls -al command, the permissions were shown as rw-r--r--. When viewed in Windows Properties, they were set correctly.

  2. The username on the remote box was not properly set up for ssh

To discover this, I logged in using tried from my Mac, setting the permissions in a linux-style. There I found that the username was not set up. Then I went back to windows and tried again, despite the permissions appearing wrong in Git bash... and it worked.

1
  • I'm struggling with this too, I might have to install a different ssh client. I can't understand how after all these years AWS doesn't put Windows instructions there. Commented Feb 11, 2022 at 2:38
0

The answer of Chao helped me, because I have WSL installed on my Windows 10.

In WSL (Ubuntu on Windows) I opened a text editor with sudo and created the file /etc/wsl.conf with text in it:

[automount]
options = "metadata"

Then rebooted my Windows.

Now I am able to edit file permissions in WSL: chmod 0600 now works!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .