-
-
Save jaskiratr/cfacb332bfdff2f63f535db7efb6df93 to your computer and use it in GitHub Desktop.
# Source: https://stackoverflow.com/a/43317244 | |
$path = ".\aws-ec2-key.pem" | |
# Reset to remove explict permissions | |
icacls.exe $path /reset | |
# Give current user explicit read-permission | |
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)" | |
# Disable inheritance and remove inherited permissions | |
icacls.exe $path /inheritance:r |
Works !
It doesn't convert it to:
-r--------
but to:
-r--r--r--
Still works for me
If you prefer to do it from UI
- select .pem file -> right click -> properties
- Security > Advanced > Disable inheritance
- Remove all Users
- Add > Select a principal
- In "Enter the object name to select" type your Windows username > ok
- Give all permissions > ok > apply
Doing this, I still have an equivalent of 444 permission in the linux filesystem.
thanks!!
https://gist.github.com/jaskiratr/cfacb332bfdff2f63f535db7efb6df93#gistcomment-3713676
for windows users use:
icacls.exe your_key_name.pem /reset
icacls.exe your_key_name.pem /grant:r "$($env:username):(r)"
icacls.exe your_key_name.pem /inheritance:r
thats it! your keys.pem have same restrisctions as you use chmod 400Thanks @audrew !!! This worked for me.
Thank you!!
If you prefer to do it from UI
- select .pem file -> right click -> properties
- Security > Advanced > Disable inheritance
- Remove all Users
- Add > Select a principal
- In "Enter the object name to select" type your Windows username > ok
- Give all permissions > ok > apply
Thanks!
Thank You!!
If you prefer to do it from UI
- select .pem file -> right click -> properties
- Security > Advanced > Disable inheritance
- Remove all Users
- Add > Select a principal
- In "Enter the object name to select" type your Windows username > ok
- Give all permissions > ok > apply
Thanks worked for me
Thank you
Thank you
In windows 10, using the commands listed above I ran into the following error:
Invalid parameter "$($env:username):(r)"
so, I changed it by
"%username%:(r)"
and it worked properly. Thanks a lot!!!
Thanks...You saved the day!
keep in mind that although both of these solutions perfectly work but itll still have owner group and other read permissions if sshing via wsl and might still give bad permisiions. so you need to ssh explicitly via powershell not wsl
This works Thanks alot
Legend
thanks
Thank you so much this had been buggin me for quite a while...
In windows 10, using the commands listed above I ran into the following error:
Invalid parameter "$($env:username):(r)"
so, I changed it by
"%username%:(r)"
and it worked properly. Thanks a lot!!!
thanks!
Thank you
Thank you!
same problem : (