我正在尝试从Windows中的java向Administrators组设置文件权限。 下面是我的代码:
rw-------
}
public static void main(String[] args) throws IOException {
final Path path = Paths.get("C:/Dev/dummy/test");
FileAttribute<?> permissions = new FileAttribute<List<AclEntry>>() {
public String name() {
return "acl:acl";
}
public List<AclEntry> value() {
try {
return get600ACL(path.getFileSystem());
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
};
Files.createFile(path, permissions);
After creating file, the permissions are proper as seen in this image
但是,当我创建一个新用户时,请给他授予管理员权限并尝试打开该文件,这表明该用户没有读取权限。 有人可以告诉我我在哪里错吗?