Spring Boot Undertow上传文件后没有可读权限

JavaSpring BootUndertow大约 590 字

Undertow上传文件至Nginx静态服务器后发现group和other没有读写权限

设置权限,伪代码

MultipartFile file;

String pathname = "/home/pic/aaa.jpg";
File f = new File(pathname);
file.transferTo(f);
log.info("transfer to: " + pathname);

Set<PosixFilePermission> perms = new HashSet<>();
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.OWNER_WRITE);
perms.add(PosixFilePermission.GROUP_READ);
perms.add(PosixFilePermission.OTHERS_READ);
//Set<PosixFilePermission> permissions = PosixFilePermissions.fromString("rw-r--r--");
Files.setPosixFilePermissions(Paths.get(pathname), perms);
阅读 1274 · 发布于 2019-04-08

————        END        ————

扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看换一批