- CLI:
:: Set Variable :: set key="C:\Path\to\key" :: Remove Inheritance :: cmd /c icacls %key% /c /t /inheritance:d :: Set Ownership to Owner :: cmd /c icacls %key% /c /t /grant %username%:F :: Remove All Users, except for Owner :: cmd /c icacls %key% /c /t /remove Administrator BUILTIN\Administrators BUILTIN Everyone System Users
CLI:
:: Set Variable :: set key="C:\Path\to\key" :: Remove Inheritance :: cmd /c icacls %key% /c /t /inheritance:d :: Set Ownership to Owner :: cmd /c icacls %key% /c /t /grant %username%:F :: Remove All Users, except for Owner :: cmd /c icacls %key% /c /t /remove Administrator BUILTIN\Administrators BUILTIN Everyone System Users :: Verify :: cmd /c icacls %key%
- CLI
# Set Variables # Key key="/path/to/key" # User: user="$(echo $USER)" # Set Ownership # This assumes user's name is also user's group name chown $user:$user $key # Set Access Rights chmod 0600 $key
CLI
# Set Variables # Key key="/path/to/key" # User: user="$(echo $USER)" # Set Ownership # This assumes user's name is also user's group name chown $user:$user $key # Set Access Rights chmod 0600 $key # Verify ls -l $key