Secret files such as ssh private keys are stored in plain on the disk.
There is only one user account on my computer.

Programs like ssh.exe need to read these files, and I want to view them by text editors like Visual Studio Code, too.

However, some bad applications, which sometimes run as Administrator or even run as SYSTEM, scan disks and read such secret files. (They won't modify.)

Is there any way to allow only a few programs to access a certain folder and read files? (Like a white-list) Thank you.

  • 1
    Actually do you really ever need to view the private keys in a text editor? There aren't any good generic answers for miscellaneous files, but if you were asking specifically about restricting private key usage, there are quite a few solutions for that.
    – user1686
    Jan 23, 2019 at 6:31
  • 2
    What are these "bad applications" running as an administrator or "root"? It sounds like that system is already compromised, potentially along with everything on it. Why not eliminate that problem first, and automatically nullify this whole question in the process?
    – Xen2050
    Jan 23, 2019 at 6:31
  • 1
    @grawity sshkey is just an example. Some configuration files may contain passwords for remote databases, sometimes I need to change some sittings.
    – Kane Green
    Jan 23, 2019 at 6:40
  • 1
    @Xen2050 Some software companies scan hard drives for sensitive files in the name of "anti game cheats" or "protect account security". I don't want to mention the names of those companies here, but they do exist.
    – Kane Green
    Jan 23, 2019 at 6:43
  • 1
    Yes, it's a cat & mouse game. From where I stand, it’s very difficult to find a clear line between a malware and a normal software. What is important is what you want to protect. I don't think anti-cheat needs collecting my databases passwords. I've use Microsoft's ProcessMonitor confirmed that my config.json has been read so many times.
    – Kane Green
    Jan 23, 2019 at 7:11

1 Answer 1


I recently found that Windows has Minifilter drivers to do that, but I couldn't find an out-of-the-box solution to use (except those heavy HIPS software like Comodo Internet Security and Huorong Security).

(You could try start with CynicalApe/Minifilter-CSHARP-ConsoleApp if you would like to write it yourself)

I really hope Microsoft could just add this feature to the existing Controlled folder access of Windows Defender.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.