SFTP with Chroot JAIL

Thanks to Miro for the info

Please read the following guide


Download soruce of openssh
Replace the sft-server.c source with the one provided on the page above (or here)
compile it - the only thing we are going to need is the sftp-server binary
        cd <source openssh>
        make -j 10
   after compilation finishes you should have sftp-server file
Make backup of your old sftp-server file
        for standard solaris ssh installation
        mv /usr/lib/ssh/sftp-server /usr/lib/ssh/sftp-server.ori

        and copy the newly compiled sftp-server binary
        cp <source openssh>/sftp-server /usr/lib/ssh/
        chmod +s /usr/lib/ssh//sftp-server
Restart ssh and test if sftp access still works the same way as before
Now the chroot stuff comes
        edit sftpsh.c file if needed and change the location of your sftp-server file
(or leave it as it is, it points to /usr/lib/ssh/sftp-server)
        compile it
        gcc sftpsh.c -o sftpsh
        and copy it to some location
        cp sftpsh /bin/
Edit /etc/passwd
        change the shell of the chrooted sftp-only user to /bin/sftpsh
        change users home directory so it is chrooted
        example: /export/home/my_user change to /export/home/my_user/./
Now, it should work. please test