Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 585217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:58:47+00:00 2026-05-13T14:58:47+00:00

I’m trying to lock down a registry key with some important information that must

  • 0

I’m trying to lock down a registry key with some important information that must be accessible at the client machine, I do not wan’t non-administrators to have access to this key. If you are an admin you’ll already be able to do more damage than what I’m storing in the key.

What I’m currently looking to do is this:

//Allow access only to administrators and deny all rights to everyone else.
System.Security.AccessControl.RegistrySecurity acl = 
new System.Security.AccessControl.RegistrySecurity();
acl.AddAccessRule(
    new System.Security.AccessControl.RegistryAccessRule(
        "Administrators", 
        System.Security.AccessControl.RegistryRights.FullControl, 
        System.Security.AccessControl.AccessControlType.Allow));

acl.AddAccessRule(
    new System.Security.AccessControl.RegistryAccessRule(
        "Everyone",
        System.Security.AccessControl.RegistryRights.FullControl,
        System.Security.AccessControl.AccessControlType.Deny));

//Prevent inherited read access from the software or company key allowing access.
acl.SetAccessRuleProtection(true, false);

MyKey.SetAccessControl(acl);

If I have it right this will deny access to everyone, allow access explicitly to anyone in the administrators group and will prevent all inherited permissions from applying to my key? I’d rather find out if it will work before I screw up the ACL on the key such that I can’t delete it etc. Should I set the owner of the key to be the administrators group as well?

PS: It’s very important that the key cannot even be read as a non administrator, not just changed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:58:48+00:00Added an answer on May 13, 2026 at 2:58 pm

    Be very careful with deny rules – they’re only rarely necessary.

    If the only ACE in the ACL is for administrators giving them the access you want them to have, then no one else will have access to the key since there’s no ACE granting them access.

    It’s unclear to me from the documentation for AddAccessRule() if it’ll guarantee that a new rule (or ACE) will be added to the end of the ACL or not. This is likely to be the case, but if it’s happens to not work that way and your deny ACE ends up before the ACE granting access to Admins, then the deny ACE will ‘override’ the one granting access (the first system stops looking at the ACL once it hits the first ACE that grants or denies permission). This is why using deny ACE’s can be tricky. And since an ACL that doesn’t explicitly grant permission causes the access check to fail, you generally only need to specify who is permitted access.

    You will likely want to ensure that the owner is set to the admin group – an owner can have no access to a key (or whatever object), but an owner always has the right to change the ACL (makes sense if you think about it for a moment).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.