$acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys $acl.SetAccessRuleProtection($true, $false) $administratorsRule = New-Object system.security.accesscontrol.filesystemaccessrule("Administrators","FullControl","Allow") $systemRule = New-Object system.security.accesscontrol.filesystemaccessrule("SYSTEM","FullControl","Allow") $acl.SetAccessRule($administratorsRule) $acl.SetAccessRule($systemRule) $acl | Set-Acl
public static String getCN(final X509Certificate cert) { Args.notNull("cert", cert); try { final String subjectPrincipal = cert.getSubjectX500Principal().getName(X500Principal.RFC2253); for (final Rdn rdn : new LdapName(subjectPrincipal).getRdns()) { final Attribute cnAttr = rdn.toAttributes().get("cn"); if (cnAttr != null) { try { final Object cnValue = cnAttr.get(); if (cnValue != null) return cnValue.toString(); } catch (final Exception ex) { LOG.debug(ex); } } } } catch (final InvalidNameException ex) { LOG.debug(ex); } return null; }