You seem to have a point - I see no reason why "0644" is chosen if timestamp is not preserved...
________________________________ From: carsten.moel...@fiduciagad.de <carsten.moel...@fiduciagad.de> Sent: Thursday, July 27, 2017 5:55 PM To: dev@mina.apache.org Subject: SCPClient upload: FilePermission depends on setting Timestamp Hi, I experienced some trouble trying to upload data with the SCPClient class. It seems that using the parameter "perms" depends on whether the parameter "time" is set. Is that meant to act this way? Seems somewhat strange to me. Code: ScpClient scpClient = session.createScpClient(); Collection<PosixFilePermission> perms = EnumSet.of (PosixFilePermission.OWNER_READ, PosixFilePermission.OTHERS_EXECUTE); long now = System.currentTimeMillis(); ScpTimestamp tsp = new ScpTimestamp(now, now); scpClient.upload("test\n".getBytes(), "test.txt", perms, null); //uploads Data with Permissions "644" scpClient.upload("test\n".getBytes(), "test2.txt", perms, tsp); //uploads Data with Permissions "401" as requested results in Files: -r-------x 1 group users 5 Jul 27 16:33 test2.txt -rw-r--r-- 1 group users 5 Jul 27 16:33 test.txt The class SCPHelper (method sendStream, line 608) builds the scp command like this: Set<PosixFilePermission> perms = EnumSet.copyOf (resolver.getPermissions()); String octalPerms = preserve ? getOctalPermissions(perms) : "0644"; String fileName = resolver.getFileName(); String cmd = "C" + octalPerms + " " + fileSize + " " + fileName; So it depends on the param "preserve", which is set in DefaultSCPClient line 128 as "time != null".