Skip to content

Instantly share code, notes, and snippets.

View YichuanSun's full-sized avatar
😅
🥬🐶

Yichuan Sun YichuanSun

😅
🥬🐶
  • Sifangping Sports College
  • Changsha
  • 07:50 (UTC +08:00)
View GitHub Profile
@YichuanSun
YichuanSun / chmod-400.cmd
Created November 30, 2022 13:04 — forked from jaskiratr/chmod-400.cmd
Set permission of file equivalent to chmod 400 on Windows.
# 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