设置文件权限的两种方式---POSIX

时间:2025-04-28 08:13:30
  • ()
    Path path = ("/home/icer/");
    
    PosixFileAttributes attr = null;
    		
    try {
    	attr = (path, , LinkOption.NOFOLLOW_LINKS);
    } catch (Exception e) {
    	();
    }
    		
    FileAttribute<Set<PosixFilePermission>> posixAttrs = (());
    		
    try {
    	(path, posixAttrs);
    } catch (Exception e) {
    	();
    }

  • ()
    Path path = ("/home/icer/");
    		
    try {
    	Set<PosixFilePermission> permissions = ("rw-r--r--");
    		
    	(path, permissions);
    } catch (Exception e) {
    	();
    }