Results 1 to 4 of 4

Thread: SSH Chroot Isn't Working

  1. #1
    Join Date
    Jul 2012
    Location
    Illinois, USA
    Beans
    540

    Question SSH Chroot Isn't Working

    Hey guys,

    I am trying to set up an SSH chroot for a user group, based on instructions here: http://allanfeid.com/content/creatin...ail-ssh-access

    I have done this before in the past and it doesn't seem to be working for me this time, not sure what I'm doing wrong this time...

    /etc/ssh/sshd_config:
    Code:
    Match group jailusers
              ChrootDirectory /var/jail/
              X11Forwarding no
              AllowTcpForwarding no
    /var/jail:
    Code:
    root@myserver:/var/jail# ls
    bin  dev  etc  lib  lib64  usr
    root@myserver:/var/jail# ls /var/jail/bin/
    bash  cp  ls  pwd  rm
    root@myserver:/var/jail#

    ssh output:
    Code:
    root@myserver:~# ssh test@localhost
    test@localhost's password: 
    Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.8.0-32-generic x86_64)
    
    
    Last login: Fri Jan 20 00:43:28 2017 from 127.0.0.1
    /bin/bash: Not a directory
    Connection to localhost closed.
    root@myserver:~#
    I seem to be getting /bin/bash: Not a directory, but not sure why, it should be there...

    Any suggestions?

    Thanks!

  2. #2
    Join Date
    Nov 2009
    Location
    Mataro, Spain
    Beans
    13,851
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: SSH Chroot Isn't Working

    In those instructions you linked the guy seems to be creating/copying the bash folder into /var/jail/usr/bin while according to what you posted above your bash folder seems to be in /var/jail/bin. Could that be the error?

    He used:
    Code:
    $ cd /var/jail/usr/bin
    $ cp /usr/bin/ls .
    $ cp /usr/bin/bash .
    That would make a copy of ls and bash into /var/jail/usr/bin and in your case they are in folder /var/jail/bin.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 10 Pro 64bit

  3. #3
    Join Date
    Jul 2012
    Location
    Illinois, USA
    Beans
    540

    Re: SSH Chroot Isn't Working

    Yeah I noticed that while I was working on it, no I copied everything to /var/jail/bin, not to /var/jail/usr/bin as they suggested in the article. So, that's not the issue.

  4. #4
    Join Date
    Nov 2009
    Location
    Mataro, Spain
    Beans
    13,851
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: SSH Chroot Isn't Working

    But that is exactly what I was pointing out. Assuming the tutorial is correct, you have copied folders into a different path. Wouldn't that provoke the chroot jail not working?

    Have you tried copying the folders into /var/jail/usr/bin as suggested in the tutorial?
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 10 Pro 64bit

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •