POSIX Permissions

Edwards, David edwardsd at amgen.com
Mon Oct 26 08:08:37 PDT 2009


Executing the following code



Path path = Paths.get("/home/edwardsd");

PosixFileAttributes attr = Attributes.readPosixFileAttributes(path);

System.out.format("%s %s %s%n", attr.owner().getName(),

    attr.group().getName(),

    PosixFilePermissions.toString(attr.permissions()));



Produces the following output



edwardsd users rwxrwxrwx



However executing the UNIX command ls -ldi /home/edwardsd produces



32416151 drwxrwsrwx  68 edwardsd users 16384 Oct 26 07:07 edwardsd



The file has the SGID permission



Modifying permission using the code below results in the SGID permission being removed.



path.getFileAttributeView(PosixFileAttributeView.class).setPermissions(perms);



I assume this would also be an issue for the permissions SUID and StickyBit.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20091026/3d6da2c9/attachment.html 


More information about the nio-discuss mailing list