Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a jailed user "ftest" (in /home/ftest) but he can't create files or folders within the jail.

User was added by:

useradd -g nginx -G sftpjail -s /bin/false

Permissions and owners are:

755 root:sftpjail /home/ftest
755 ftest:nginx /home/ftest/test1
755 ftest:sftpjail /home/ftest/test2
777 ftest:nginx /home/ftest/test3

The chroot sftp login is working just fine, but unfortunately it's not possible to write to any of the testX folders.

share|improve this question
afaik jail exists only on FreeBSD. Are you talking about chroot or jail? – user130370 Feb 15 '13 at 12:20
You are right, sorry! chroot – Thorsten Scheckenbach Feb 15 '13 at 12:33

The problem is the ftest user doesn't have write permissions on his home directory.

/home/ftest is owned by root user and sftpjail group. ftest is indeed a member of sftpjail, but the 755 permission means the group can only read, not write from there.

You have 2 options here, either change the ownership to ftest:sftpjail, and keep the permissions 755, or keep theownership as is, but change permissions to 775.

I believe creating files inside the test folders is working fine though, right?

share|improve this answer
Unfortunately that's not an option. I tried both but the chroot only works with root:root and 755 – Thorsten Scheckenbach Feb 15 '13 at 13:37
what do you mean by "only works with.."? is there some error? can you elaborate? – Waleed Hamra Feb 15 '13 at 14:22
If the rights of the home directory are wrong I can't login via sftp. I always get asked for a password which is not set for ftest user which has an rsa-key set. – Thorsten Scheckenbach Feb 15 '13 at 14:42
but that relates to the permissions of .ssh/authorized_keys only, no? – Waleed Hamra Feb 15 '13 at 19:37
No, the log says: "bad ownership or modes for chroot directory" – Thorsten Scheckenbach Feb 20 '13 at 13:08

Your Answer


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.