Search code examples
pythonsecuritypermissionswindows-10

How to give applications (not users itself) permission to folder and files


Is it possible to give an application read and write permissions to folder and files during its work without giving users which use the application these permission?

i write a software in python which is working with some files. I want to ensure that these files only can manipulate by the software. So my thougt was to create a folder without read an write rights and allowing only the application to read and write in this folder. Is this possible?


Solution

  • not sure if this helps bit what i would try and do is is set the application to create a local service account first with admin rights then when the application relaunches set it to run run as that service account then any folders created will be via that service account and therefore you can create a folder, modify its permissions to only be managed by that service account, brief steps below

    1. application launches and checks if the service account exists if not then create the service account and assign to relevant admin group, once complete re-launch as that service account

    2. once launched create the relevant directory

    3. modify the directory's settings so all users are removed exp the service account

    I think the above might work, good luck!