How to give read and write access to a specific directory to a specific program?

windows and linux have permission management for users (groups). Can you also set read and write permissions for specific programs (processes)?
if possible, please point out the operation methods under win10 and linux.


an idea:
Linux can create a separate user, use that user to run the program, and then use chown to change the directory to that user's. In this way, the program can only operate the files in this directory, but it can still read the files in other directories.

if you really want to do a good job of quarantine, you are advised to use docker directly.

Menu