question

VedanthPulipati-4457 avatar image
0 Votes"
VedanthPulipati-4457 asked MotoX80 edited

Powershell command to disable the .ssh folder to other users

I have created the folder in the windows agent with the .ssh keys using admin i want to disable it for the other users who logged into system. i tried using GetCL commands but got confused how to use it in the automation. Any suggestions please

windows-server-powershellazure-virtual-machines
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MotoX80 avatar image
1 Vote"
MotoX80 answered MotoX80 edited

Just use icacls.exe in your Powershell script to disable inheritance (if there is any) and set the permissions to whatever suits your requirements.

https://4sysops.com/archives/icacls-list-set-grant-remove-and-deny-permissions/

https://adamtheautomator.com/icacls/

Maybe like this:

 icacls.exe c:\temp\test /inheritance:r /grant administrators:(OI)(CI)(F)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.