POSIX Permissions
Alan Bateman
Alan.Bateman at Sun.COM
Mon Oct 26 08:45:52 PDT 2009
Edwards, David wrote:
>
> 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.
>
Right, PosixFileAttributeView only supports the file permissions and not
the sticky bit or user/group set-ID bits. So far this has not been a
problem. Our providers on Solaris/Linux do have extensions for this but
it requires using a provider specific "unix" view.
-Alan.
More information about the nio-discuss
mailing list