ChrootDirectory in SFTP Couldn't get handle: Permission denied

I have compiled and installed Openssh 5.3 on my centos 5.3 server following these instructions:
http://binblog.info/2009/02/27/packaging-openssh-on-centos/

However I CAN NOT seem to get ChrootDirectory to work properly

I have changed so many things at this point I don't even know where I am at this point...

I followed the directions I found here:
http://www.debian-administration.org/articles/590

I can connect via SFTP but once connected I can't do anything:

computer:~ user$ sftp test2@172.16.16.121
Connecting to 172.16.16.121...
tetest2@172.16.16.121's password:
sftp> ls
Couldn't get handle: Permission denied
sftp> cd download
Couldn't canonicalise: Permission denied
sftp> put test.txt
Uploading test.txt to /test.txt
Couldn't get handle: Permission denied

Here are my users settings:
[root@sftp ~]# more /etc/passwd |grep test2
test2:x:504:502::/:/bin/bash
[root@sftp ~]# more /etc/group |grep test2
sftponly:x:502:integra_prod,test2

Here are my settings in /etc/ssh/sshd_config:
# override default of no subsystems
#Subsystem      sftp    /usr/libexec/openssh/sftp-server -f LOCAL1 -l INFO
Subsystem       sftp    internal-sftp

Match group sftponly
ChrootDirectory /chroot/disk2/%u
        X11Forwarding no
        AllowTcpForwarding no
        ForceCommand internal-sftp

Here are the permissions of the folder
drwx------   3 root root  4096 Jan  6 04:14 chroot
drwx------  5 root root 4096 Jan  6 11:08 disk2
drwx------ 3 root root 4096 Jan  6 11:11 test2

Now I have found that people saying it is a permission issues so I give test2 ownership of the /chroot/disk2/test2 directory and then when I try to connect it just kicks me out:
Connecting to 172.16.16.121...
test2@172.16.16.121's password:
Connection to 172.16.16.121 closed by remote host.
Connection closed



LVL 8
brittonvAsked:
Who is Participating?
 
brittonvConnect With a Mentor Author Commented:
Changing the permissions for the parent folders to 701 was the fix.
0
 
joolsCommented:
check the logs in /var/log

Can you copy files using scp?  scp localfilename user@remotehost:/path/to/somewhere

You could have selinux stoping you? `getenforce` if it's set to `1` try `setenforce 0` then give it another go.
0
All Courses

From novice to tech pro — start learning today.