I'm trying to set the file mode of a remote located file in a SMB share though SMBJ library. But I get STATUS_INVALID_PARAMETER error.
This is my code snippet:
Set<FileAttributes> fileAttributes = new HashSet<(Arrays.asList(FileAttributes.FILE_ATTRIBUTE_DIRECTORY));
Set<SMB2CreateOptions> createOptions = new HashSet<>();
createOptions.add(SMB2CreateOptions.FILE_DIRECTORY_FILE);
File f = share.openFile("folder01/abc.sh", new HashSet<(Collections.singletonList(AccessMask.GENERIC_ALL)), fileAttributes, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN_IF, createOptions);
f.setFileInformation(new FileModeInformation(755));
And this is the stack trace I'm seeing
com.hierynomus.mssmb2.SMBApiException: STATUS_INVALID_PARAMETER (0xc000000d): SetInfo failed for SMB2FileId{persistentHandle=f2 29 00 00 01 00 00 01}
at com.hierynomus.smbj.share.Share.receive(Share.java:380)
at com.hierynomus.smbj.share.Share.sendReceive(Share.java:359)
at com.hierynomus.smbj.share.Share.setInfo(Share.java:191)
at com.hierynomus.smbj.share.DiskShare.setFileInformation(DiskShare.java:330)
at com.hierynomus.smbj.share.DiskEntry.setFileInformation(DiskEntry.java:89)