Skip to content

Instantly share code, notes, and snippets.

@SebastianRiquelmeM
Created April 15, 2022 22:54
Show Gist options
  • Save SebastianRiquelmeM/a3cc905ea6bfc3d9a0903ee9c89108b2 to your computer and use it in GitHub Desktop.
Save SebastianRiquelmeM/a3cc905ea6bfc3d9a0903ee9c89108b2 to your computer and use it in GitHub Desktop.
How to do chmod400 on windows powershell.
# 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
@SebastianRiquelmeM
Copy link
Author

Replace ".\aws-ec2-key.pem" with the path and name of your .pem file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment