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.
- Tried using this guide with File Explorer:
- Tried using this guide with PowerShell as Admin, and ICACLS:
Windows SSH: Permissions for 'private-key' are too open - Tried good ole' fashioned:
chmod 600 with Git Bash. ng. - I followed the instructions in this vid (skip to 5:17):
- 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
I got in. For posterity, here's what was happening. It was a two-part problem.
I am using Git Bash. On an
ls -alcommand, the permissions were shown asrw-r--r--. When viewed in Windows Properties, they were set correctly.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.
1The 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!