LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Chroot acess with ssh and sftp problem (https://www.linuxquestions.org/questions/linux-general-1/chroot-acess-with-ssh-and-sftp-problem-850414/)

dreamline 12-15-2010 10:23 AM

Chroot acess with ssh and sftp problem
 
Hi All,
I'm new to the forum so a big hi to you all. Anyways now onwards to my problem: I followed the following instruction Chrooted SSH/SFTP Tutorial (Debian Etch) and was able to create a chrooted ssh connection. However as soon as I added these lines to sshd_config I was not able to connect to SSH but was able to connect with SFTP:

Match User tstuser
ChrootDirectory /home/cage/ or /home/cage/home or /home/cage/home/tstuser
X11Forwarding no
AllowTCPForwarding no

I have tried about anything and did hours of reading on the internet (also this forum), but came up with no solution for my problem. The problem is as soon as I add the ChrootDirectory Directive my ssh and sftp connection both stop working when logging in. As soon as I use the last ChrootDirectory directive (/home/cage/home/tstuser) then I can login using sftp but can't login using ssh. I've also set the sftp server to internal but no difference.

What am I missing here? I can't seem to get it right. I hope someone experienced a similar problem and found a solution. Any help is welcome. I used a script to create the chroot environment following the instructions. :)

Regards,
Dreamline

stress_junkie 12-15-2010 10:41 AM

You neglected to provide a link to the instructions that you used.

Nevertheless the first thing that comes to mind is that the chroot jail does not have the necessary ssh software or some other software is missing from the jail.

dreamline 12-15-2010 06:32 PM

Oh sorry. Here's the instructions I followed: [URL="http://www.howtoforge.com/chroot_ssh_sftp_debian_etch"].
I also checked the sftp software and sft-server bin is at the jailroot where it should be. So I don't have a clue what I'm missing. :(

Edit: I think I solved my problem. I ran the script make_chroot_jail.sh with only the user option. In that case /bin/chroot-shell is added in /etc/passwd. When I ran the script with the /bin/bash option everything works and I am locked in my homedir when using Putty and when using SFTP. Even the sshd_config entry for ChrootDirectory works now.

Thanks for helping though.. :)


All times are GMT -5. The time now is 02:09 AM.