Created
June 13, 2020 11:21
-
-
Save tuyendq/88f7f69d395eaee07d3a39c719b154cd to your computer and use it in GitHub Desktop.
Set permission SSH Private Key File
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
:: Set key variable as full path the the private key id_rsa file :: | |
:: set key="%userprofile%\.ssh\id_rsa" | |
set keyname="ocifree" | |
set key=%~dp0%\%keyname% | |
:: Remove default inheritance :: | |
cmd /c icacls %key% /c /t /inheritance:d | |
:: Set ownership to the owner :: | |
cmd /c icacls %key% /c /t /grant %username%:F | |
:: Remove All users, except the owner :: | |
cmd /c icacls %key% /c /t /remove Administrator Administrators SYSTEM "Authenticated Users" "Users" AzureAD\TuyenDang | |
:: Then verify settings :: | |
cmd /c icacls %key% | |
:: End of script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment