I run a java program by a non-root user.
The program has to resolve a symlink to the real file name,
but the link is owned by a different non-root user.
I used setcap to set capabilities to open root-privileged sockets etc. but when trying to resolve the link using Files.readSymbolicLink() I get java.nio.file.AccessDeniedException exception.

What capabilities allows this?

Java 8
OS: centos 7

  • Does the user have read and execute perms on the directory that contains the symlink? – jordanm Sep 2 '15 at 16:15
  • Yes. both the file that the link relates to and the directory it is located in are 755 – csny Sep 2 '15 at 16:18
  • Not the file that the link relates to, that doesn't matter at all. The directory containing the link itself is what is relevant. – jordanm Sep 2 '15 at 16:24
  • Got execute permissions: 555 – csny Sep 2 '15 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.