We have a Java program run as root on Unix, that therefore can read for example the content of the folders /home/user1
and /home/user2
. However, if the Unix user "user1" is logged in in our application, he should not be able to access "/home/user2" data.
We would like to use directly the Unix rights and not recreate all the permissions in our application !
So, could we...
- try to change the UID of our program depending on the user logged in ? Sounds difficult, and each file access is in different threads so the UID would be different on each thread of our program...
- use JNI to read permissions of
"
/home/user2
"...And then determine if user1 has sufficient permissions on "/home/user2
" ? (how ?).