I've setup /etc/ssh/sshd_config as such:
Subsystem sftp internal-sftp -u 0002 Match Group sftp ChrootDirectory %h ForceCommand internal-sftp -u 0002 AllowTcpForwarding no Match
I get the users home to /var/www and chown the owner to root:root (required for a chroot). All sub directories of that have g+s set and all users plus apache are members of that group.
All good. The user can access via sftp and alter subdirectories.
Now folders created from the client get the right permissions but not new files. Also, any files or folders copied across don't get their permissions changed. Which is what I require for apache and other ssh users to work with the files.
How can I solve this?