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

Java Spring Boot Undertow About 601 words

现象

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);
Views: 6,334 · Posted: 2019-04-08

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

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

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


Today On History
Browsing Refresh