SFTP-server uploaded files having wrong rights
If an SFTP client does not specify permissions for uploaded files, the OpenSSH SFTP server assigns 0666 permissions to newly created files (minus the umask 0002 makes the 0664).
This is hard-coded, you cannot change it. See the process_open()
function in the sftp-server.c
of OpenSSH. And even, if this was not specified explicitly, the 0666 is still the *nix default for files, you cannot just change this with umask (that's true in general, not just for OpenSSH).
See also Does OpenSSH SFTP server use umask or preserve client side permissions after put command (chrooted environment)?
Note that your umask is actually wrong. If you want 0644, use umask 0022, not 0002.
The FileZilla never specifies permissions for uploaded files. What results in the behavior you are experiencing.
To achieve your desired permissions:
-
With FileZilla you can change the file permissions only manually, after the upload, using File permissions command from a remote file context menu.
-
Use an SFTP client that allows specifying the permissions for the uploaded files.
For example WinSCP allows that.
See https://winscp.net/eng/docs/ui_transfer_custom
(I'm the author of WinSCP)