0

I not only want to transmit files via sftp, but also want to log in via ssh.

Here is what I changed in sshd_config

Match Group ssh_jail
    ChrootDirectory /mnt/chroot

I have mounted /mnt/chroot/dev, /mnt/chroot/dev/pts, /mnt/chroot/proc, /mnt/chroot/sys I have also copied bash to /mnt/chroot/bin and some lib files to /mnt/chroot/lib64

But I cannot log in via ssh. Below is what I found in /var/log/secure

Accepted password for xxx from ::1 port 53069 ssh2
pam_unix(sshd:session): session opened for user xxx by (uid=0)
error: mm_receive_fd: no message header
fatal: mm_pty_allocate: receive fds failed
pam_unix(sshd:session): session closed for user xxxx

Why is that?

yylyyl
  • 11
  • 1
  • You copied "some" lib files. Did you copy enough lib files? Have you tried `chroot /mnt/chroot /bin/bash -i` to see if bash works in your chroot? – DerfK Apr 04 '13 at 16:26
  • @DerfK bash works. Lib files are enough I think. – yylyyl Apr 04 '13 at 16:41
  • Not necessarily. What did you use to tell you the library files to copy? Did you run `ldd` on the `sshd` binary and verify that all of those are present? The failure to allocate a pty (pseudo-terminal) is rather suspect. – Andrew B Apr 04 '13 at 22:24

1 Answers1

1

I disabled SELinux and rebooted, then everything works fine now.

yylyyl
  • 11
  • 1