From this answer to question Windows SSH: Permissions for 'private-key' are too open I knew about command
Icacls "C:\Users\XX\Path\To\File" /Grant:r "%Username%":"(R)"
but in my environment (windows 10) it does not work:
Invalid parameter "%Username%"
Why it happen and how to fix it?
According to the documentation it is necessary to inform the user for the permission:
But the example above will only work for commands executed via
CMD. The message that is appearing means that the environment variable is empty. Why I can't tell you.If you are using
PowerShellyou will have to change the$Usernamevariable, in my example:In
PowershellI got the following response: