Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Debian 6

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

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?

share|improve this question
What SFTP client are you using? It's probably the client setting those permissions explicitly. –  mgorven May 30 '12 at 6:19
The client shouldn't be able to alter server side umask properties. –  gyaresu May 30 '12 at 7:01
umask doesn't set permissions. –  Ignacio Vazquez-Abrams May 30 '12 at 7:02
What do you mean umask doesn't set permissions? -u 0002 –  gyaresu May 30 '12 at 8:32
-p isn't preserving the modes? –  Jon Lin May 30 '12 at 8:44
show 2 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.