Sha256: fa814f9a1b02ea582a4d1d3d272f3fdd559b0e5fb1647257c410df91c1e3abeb
Contents?: true
Size: 828 Bytes
Versions: 29
Compression:
Stored size: 828 Bytes
Contents
# Vagrant SSH capability functions function Set-SSHKeyPermissions { param ( [parameter(Mandatory=$true)] [string] $SSHKeyPath, [parameter(Mandatory=$false)] [string] $Principal=$null ) if(!$Principal) { $Principal = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name } # Create the new ACL we want to apply $NewAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule( $Principal, "FullControl", "None", "None", "Allow") $ACL = Get-ACL "${SSHKeyPath}" # Disable inherited rules $ACL.SetAccessRuleProtection($true, $false) # Scrub all existing ACLs from the file $ACL.Access | %{$ACL.RemoveAccessRule($_)} # Apply the new ACL $ACL.SetAccessRule($NewAccessRule) Set-ACL "${SSHKeyPath}" $ACL }
Version data entries
29 entries across 25 versions & 4 rubygems