Created
June 29, 2018 01:03
-
-
Save jaskiratr/cfacb332bfdff2f63f535db7efb6df93 to your computer and use it in GitHub Desktop.
Set permission of file equivalent to chmod 400 on Windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
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!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works Thanks alot