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.
7,125 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,362 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 31,571 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