Access Admin file as normal user

S Abijith 426 Reputation points
2024-09-19T17:19:44.37+00:00

Hello All,

We have a windows application built on .Net Framework 4.8. This application has to modify a file that is present in 'C:\ProgramData\CustomApp\Configuration' folder. This file was copied by an installer that was executed with 'Admin' user privileges.

The windows application runs with non-admin credentials and hence we are getting an 'Access Denied' error when we try to modify the file using the windows application.

Can anyone let us know if it is possible to modify the file without requiring 'Admin' user privileges'?

If it is possible, how can it be done?

Any help is appreciated!

Thank you in advance!

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,498 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 54,811 Reputation points
    2024-09-19T17:38:17.7533333+00:00

    Yes it is possible, it is just NTFS permissions. Go to the folder in File Explorer and open the Properties. Go to the Security tab. Click Edit. Most likely Users is already listed as having access so select that group and then allow them to Modify the folder. Depending on what the app is doing you might need to grant Full Control but start with Modify. This should allow any user to add/edit/delete files in that folder.

    You should also adjust your installer app to grant normal users write permissions to that folder in the future.


  2. Olaf Helper 45,106 Reputation points
    2024-09-19T17:55:25.94+00:00

    'C:*ProgramData*\CustomApp\Configuration'

    The special folder "ProgramData" is designed and intended to contain application data, that can be written without admin permission; that's what this special folder is good for.

    But if the app still needs admin permissions, then the permissions on that folder are mixed up, either by the installer or some person.

    Fix the permissions on that special folder and everything will be fine.

    0 comments No comments

Your answer

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