ACLs

J

John Smith

Is there a way in java of getting the access control lists of file in
windows/linux, i.e. does user x have access to file y.

Thanks

Jon
 
C

Chris Uppal

John said:
Is there a way in java of getting the access control lists of file in
windows/linux, i.e. does user x have access to file y.

Via JNI or by launching an external (native) program which will write the ACL
info to stdout[*] which you can parse from your Java program.

-- chris

[*] I personally don't know of such a program in a standard Windows
distribution, but that doesn't mean there isn't one. Perhaps in the reskits.
Otherwise write your own.)
 
R

Rogan Dawes

Chris said:
John said:
Is there a way in java of getting the access control lists of file in
windows/linux, i.e. does user x have access to file y.

Via JNI or by launching an external (native) program which will write the ACL
info to stdout[*] which you can parse from your Java program.

-- chris

[*] I personally don't know of such a program in a standard Windows
distribution, but that doesn't mean there isn't one. Perhaps in the reskits.
Otherwise write your own.)

[*] cacls
 
R

Robert Mabee

John said:
Is there a way in java of getting the access control lists of file in
windows/linux, i.e. does user x have access to file y.

I consider it bad practice to try to duplicate the OS's algorithm for
deciding access, since this is an area subject to OS/FS enhancements,
and the access information itself may be hidden from non-root access.
For example, suppose you hard-coded the original Unix check
(owner/group/other) and then ran into the ACL extensions.

In general, the only robust way to determine A can perform system
call B is for A to go ahead and do it. I hate the style of making
snooping calls to predict whether the payload call will work, as the
payload call might still fail (for example, because of an external
change happening in the timing window) but that failure is hard to
test and the coder not likely to have coded for it properly.

In your example, make a process that runs as user x and accesses
file y (without damaging it) then reports its success ot failure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top