Last active
March 21, 2022 06:52
-
-
Save harshithjv/3483f3566c5e42ab5ac8c70dd4a5ce4a to your computer and use it in GitHub Desktop.
Set private (read-only) permission for .pem file on Windows
This file contains hidden or 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
REM Use icacls command in windows OS to set file permission which operates chmod in *nix platform. This script can be run on classic command prompt. | |
REM Syntax: | |
REM icacls.exe <ssh_Key_filename> /reset | |
REM icacls.exe <ssh_Key_filename> /grant:r "%username%":"(R)" | |
REM icacls.exe <ssh_Key_filename> /inheritance:r | |
icacls.exe vm_access.pem /reset | |
icacls.exe vm_access.pem /grant:r "%username%":"(R)" | |
icacls.exe vm_access.pem /inheritance:r |
This file contains hidden or 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
# Use icacls command in windows OS to set file permission which operates chmod in *nix platform. This script is meant for powershell execution. | |
# Syntax: | |
# icacls.exe <ssh_Key_filename> /reset | |
# icacls.exe <ssh_Key_filename> /grant:r "$($env:username):(r)" | |
# icacls.exe <ssh_Key_filename> /inheritance:r | |
icacls.exe vm_access.pem /reset | |
icacls.exe vm_access.pem /grant:r "$($env:username):(r)" | |
icacls.exe vm_access.pem /inheritance:r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment