Skip to content

Instantly share code, notes, and snippets.

@MuriloTatebe
Forked from jaskiratr/chmod-400.cmd
Created November 21, 2020 18:22
Show Gist options
  • Select an option

  • Save MuriloTatebe/2bf2f79c6465a6d759f81d4ee0f7ae05 to your computer and use it in GitHub Desktop.

Select an option

Save MuriloTatebe/2bf2f79c6465a6d759f81d4ee0f7ae05 to your computer and use it in GitHub Desktop.

Revisions

  1. @jaskiratr jaskiratr created this gist Jun 29, 2018.
    8 changes: 8 additions & 0 deletions chmod-400.cmd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # 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