I have ran a shell script to chroot SSH, this way users will not be able to browse directories and files out of the jail.
The script can be found at:
After installation I am able to successfully ssh my fedora box from a remote xp host using putty. Good! chrooted ssh is working, not the case of SFTP and SCP.
Using the same process with WinSCP results in failure.
Going after the logs I found out the following:
Jan 28 23:41:15 localhost sshd: Accepted password for testuser from 10.10.10.51 port 4385 ssh2
Jan 28 23:41:15 localhost sshd: pam_unix(sshd:session): session opened for user testuser by (uid=0)
Jan 28 23:41:15 localhost sshd: subsystem request for sftp
Jan 28 23:41:15 localhost sudo: testuser : sorry, you must have a tty to run sudo ; TTY=unknown ; PWD=/home/chroot/home/testuser ; USER=root ; COMMAND=/usr/sbin/chroot /home/chroot /bin/su - testuser -c /usr/libexec/openssh/sftp-server
Jan 28 23:41:15 localhost sshd: pam_unix(sshd:session): session closed for user testuser
I cat my sudoers files and I find an entry for this user at the end of the file:
testuser ALL=NOPASSWD: /usr/sbin/chroot, /bin/su - testuser
I cannot figure it out though.
I lack knowledge editing this file.
Any help, suggestion will be appreciated.