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

I chrooted a user to the directory /var/www/upload using ChrootDirectory /var/www/upload in my etc/ssh/sshd_config.

The permissions of all the files in var/www/upload is 755 and owner is root:upload_user.

However, I still cannot modify the files. (Getting a permission denied error.) Is it possible if I create a subdirectory with ownership upload_user:upload_user.

Is it, by any means, possible to allow my chrooted user to write to his / directory?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Is it possible if I create a subdirectory?

Yes, it will be possible to modify the files if you create a subdirectory.

Is it, by any means, possible to allow my chrooted user to write to his home directory?

Using home directory for chrooting users is highly discouraged (but you asked "by any mean"):

Modify openssh source code and introduce security breach :

Is there another way to restrict SFTP to a user's home directory? No, and I don't think one is necessary. If having to create a subdirectory (which users can automatically be cd'd to on sftp login) is so onerous then feel free to reintroduce CVE-2009-2904 by removing the checks in session.c:safely_chroot().

share|improve this answer

Change the directory mode to 770 or 775. With 755 only root has write acces to it. upload_user group only have read and execute/changedir.

share|improve this answer
1  
770 and 775 are likely to lead to "fatal: bad ownership or modes for chroot directory component" error messages. –  coincoin Oct 2 '12 at 11:38
    
If I do this I get a fatal: bad ownership or modes for chroot directory "/var/www/upload" error. –  Zulakis Oct 2 '12 at 11:42

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.