Forums Register Login

UNIX file permissions

+Pie Number of slices to send: Send
Greetings Everyone!

I am working on a vulnerability assessment/compliance UNIX project covering multiple *nix platforms and have a question. One aspect of the assessment is file permissions (SUID, SGID, world-writeable, etc.). From the research I've done the standard permissions (ugo/rwx) and possibly file ACLs are available through the java.nio.file.attribute package, but the SUID, SGID, and sticky bits are too UNIX-specific and Java does not return these.

Therefore my questions are:
1) Is my research is accurate?
2) If it is accurate then is there a relatively easy way to determine the SUID/SGID permissions code-wise through Java? I really do not want to exec out to the OS to run a long file listing (ls -l) and parse the output if I can help it. If I have to do that I will, but that leads to another question - would it then be better to parse the entire file permissions mask manually and not use the java.nio.file.attribute package?
3) If it is not accurate, what package(s)/Java tricks am I missing?

Thank you for any insight you can give.

jc
1
+Pie Number of slices to send: Send
Welcome to CodeRanch!

I agree with your research. The closest Java has was Java 7's Posix view, but it doesn't have that level of detail. I think you'll have to use exec. And yes, if you are using exec, you might as well have UNIX code do the whole thing. It isn't as if your code is going to be operating system agnostic. The only advantage to using the NIO classes is to minimize the parsing logic. But if you have to do it anyway...
+Pie Number of slices to send: Send
Or mix in some JNI.
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 909 times.
Similar Threads
Applets and UNIX File permissions
JAAS and Policy files problems
Using SUDO
what is the use of the private static long serialVersionUID variable ?
IBM free voucher for certification tests
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:20:43.