I am connecting using (S)FTP. I did some further tests transferring files using Filezilla, command line sftp and via edtFTPj/pro library. Here are the resulting file permissions.
-rw-rw-r-- 1 ftpUser ftpUser 11 Jun 22 23:43 file1.txt
-rw-rw-r-- 1 ftpUser ftpUser 9 Jun 22 23:51 file2.txt
-rw-rw-r-- 1 ftpUser ftpUser 27 Jun 23 04:06 msg.txt
-rwxr-xr-x 1 ftpUser ftpUser 27 Jun 23 03:56 upload.txt
file1.txt and file2.txt was transferred using Filezilla
msg.txt using command line SFTP
upload.txt using edtFTPj/pro
So why are the files transferred by edt different? Now, I did a debug log and saw this line:
[DEBUG] {(S)FTP Client 2 [251, 0] OUTPUT} (com.enterprisedt.SftpClient) chmod(755,/home/ftpUser/REN46663/upload.txt)
[DEBUG] {(S)FTP Client 2 [251, 0] OUTPUT} (com.enterprisedt.SftpClient) chmod(actual=/home/ftpUser/REN46663/upload.txt)
So I disabled chmod after transfer and create directory, but the resulting permission is still the same, -rwxr-xr-x:
[DEBUG] {(S)FTP Client 2 [251, 0] OUTPUT} (com.enterprisedt.SSHFTPClient) DISABLE_CHMOD_AFTER_PUT is set
[DEBUG] {(S)FTP Client 2 [251, 0] OUTPUT} (com.enterprisedt.SSHFTPClient) DISABLE_WAIT_FOR_CHANNEL_CLOSE is set
[DEBUG] {(S)FTP Client 2 [251, 0] OUTPUT} (com.enterprisedt.SSHFTPClient) DISABLE_CHMOD_AFTER_CREATE_DIR is set
I did a code debug of com.enterprisedt.net.j2ssh.SftpClient.put( ) and got this:
FileAttributes attr = new FileAttributes();
permissions = new UnsignedInteger32(default_permissions & ~umask);
attr.setPermissions(permissions);
So, is this where we are getting that file permission 755?
For my tests above, which one is using the correct file permission? Is it edt or Filezilla and command line sftp?