Windows: How to Do chmod 400? (2024)

I recently switched from macOS to Windows 10 for some projects when using AWS, and of course, met some small but uncomfortable issues. The first one is chmod 400 on the .pem file. It is quite straightforward to do so in macOS (just key in chmod 400 “yourpemfile.pem” in the terminal is enough). However, there is no chmod command in Windows. There are two ways to do so:

  • Use GUI
  • Use PowerShell

This is the most straightforward way.

Step 1: Go to the folder of the pem file and right-click the pem file to select “properties”. In the pop-up window, select the “Security” tab, and then click “Advanced” at the bottom.

Windows: How to Do chmod 400? (1)

Step 2: In the pop-up window, disable inheritance at the bottom first.

Windows: How to Do chmod 400? (2)

Step 3: Ensure that you are the owner and the only one who has full control of the file. If you are not the owner of the file, you can change it by clicking the button. If you know your username, key it in the blank and press OK directly.

Windows: How to Do chmod 400? (3)

Otherwise, click “Advance” and then search to find your username to add it.

Windows: How to Do chmod 400? (4)

Step 1: Open a folder, type “PowerShell” and then press Enter

Windows: How to Do chmod 400? (5)

It will pop up the PowerShell window as below.

Windows: How to Do chmod 400? (6)

Step 2: Run the command below. The first one is to reset pem file properties, the second one grants read-only access to the file, and the third one is to inherit the right.

icacls.exe “mypemfile.pem” /reset
icacls.exe “mypemfile.pem” /grant:r “$($env:username):(r)”
icacls.exe “mypemfile.pem” /inheritance:r

https://www.youtube.com/watch?v=P1erVo5X3Bs&ab_channel=LinuxAcademy

Windows: How to Do chmod 400? (2024)
Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 6722

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.