Home > Software engineering >  AccessDeniedException when directory rights is not 777
AccessDeniedException when directory rights is not 777

Time:12-17

I run java application as user, who is the owner of the directory and the file

System.getProperty("user.name") == "wfadmin"

# ls -la /usr/WF/WF_PPRB/SSL/certs/ignite/
-rw-r----- 1 wfadmin   wfgroup     34 Dec 16 15:31 token.txt
-rw-r----- 1 wfadmin   wfgroup   2058 Oct  9 17:50 truststore.jks
# ls -la /usr/WF/WF_PPRB/SSL/certs/
drw-r----- 2 wfadmin   wfgroup   4096 Dec 16 15:31 ignite

But when i try to read file in java:

Files.readAllBytes(Paths.get("/usr/WF/WF_PPRB/SSL/certs/ignite/truststore.jks"))

I got AccessDeniedException

If i give rights 777 to directory /usr/WF/WF_PPRB/SSL/certs/ignite/, but truststore.jks still 640 - its work correctly

CodePudding user response:

In order to access a directory, you need to have the X/Execute/Traverse permission.

  • Related