Powershell command to disable the .ssh folder to other users

Vedanth Pulipati 241 Reputation points
2022-05-23T15:49:55.583+00:00

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

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Answer accepted by question author
  1. MotoX80 37,151 Reputation points
    2022-05-23T16:47:41.567+00:00

    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)
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.