简体   繁体   中英

Java launch application with restricted file read/write permissions

At first, sorry for my bad english. I'm from Germany. Currently i am programing an Java application that executes applications remotely. Now i want to restrict the file access for each process that every process can only read and write files in his specific working Directory and files in directorys below but not files in directorys above. This program should be work on windows and on linux. My First idea was to create for every process an new user with the specific Access permissions but i don't know how i can do this in Java and this soulution sounds for me a little bit dirty.

At that time, when I asked this question, I basically wanted to only automatically start processes and additionally isolate the processes from the rest of the system.

This Problem becomes now realy simple to solve through Docker and Kubernetes.

You can run:

    docker run -v <Host-Directory>:<Container-Directory> -d --rm dockerimage

Through the -v <Host-Directory>:<Container-Directory> switch you can mount a specific directory to an directory in the docker container. You can read more about that in the Docker Documentation: https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v---read-only

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM