
How to do the CHMOD 400 Equivalent Command on Windows
How to do the CHMOD 400 Equivalent Command on Windows
This video shows you how to perform the equivalent of the chmod 400 command using powershell on Windows 10. This method uses icacls.exe to change or edit file permissions.
Twitter: https://twitter.com/choobtorials
►Try Audible Premium Plus and Get Up to Two Free Audiobooks https://amzn.to/3jJdG0M
=====
This may help you fix things when you get this error when trying to SSH to an AWS EC2 instance using Windows:
WARNING: UNPROTECTED PRIVATE KEY FILE!
Permissions for ‘yourprivatekey.pem’ are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
=====
In this video, I’ll show you how to do the equivalent of the chmod 400 command on windows. Chmod stands for change mode. It is a unix command, and is not available on windows. This command allows you to restrict access to files. Chmod 400 changes a file’s permission to be read only.
So how do we do the equivalent of this chmod 400 on windows.
First, open a powershell window in the same folder that contains the file whose permissions you would like to change. In this example, I have a file named key.pem, and I would like to edit its permissions.
Then type icacls.exe, which is the program that we are going to use to edit these permissions. And then we say the name of the file to edit, followed by /reset. This will replace the file’s access control list with the default.
And then we type icacls.exe and the file name once again, followed by /grant:r so that we can replace all of the previously granted explicit permissions.
And then we pass this argument at the end ”$($env:username):(r)“. This will grant the currently logged in user, read permissions on the file.
And then we say icacls.exe and the file name one last time, followed by /inheritance:r to remove all the inherited access control entities.
And that’s it. The permissions have now been changed. This file now has similar restrictions as if chmod 400 was applied to it.
Twitter: https://twitter.com/choobtorials
#SSH #NetworkSecurity #CloudComputing
Content
Source: https://www.youtube.com/watch?v=P1erVo5X3Bs