Chrooted SSH HowTo question???

Discussion in 'HOWTO-Related Questions' started by ctroyp, Jan 19, 2006.

  1. falko

    falko Super Moderator Howtoforge Staff

    Why is /home/jail/home/mike owned by root:bin? It should be owned by mike...
     
  2. Soap_Dude

    Soap_Dude New Member

    Yeah... I changed that, but still get the same error.
     
  3. falko

    falko Super Moderator Howtoforge Staff

    Do you use Debian? Did you follow the tutorial as colse as possible?
     
  4. Soap_Dude

    Soap_Dude New Member

    I use ubuntu, close enough. Yeah, I followed every step, (and in the process accidently wiped out my passwd file, which was extremely stupid, lol).

    Anyway, thanks falko. I'll try to figure it out from now on.
     
  5. seanheng

    seanheng New Member

    chroot ssh for fedora 5 with ssh chroot howto

    hello
    Im trying to use the chroot howto but im using f5 i was told to follow it even
    tho its for the debian sarge here is where i am stuck i tried substituting yum for apt-get
    but it says theres no match for those files

    help please

    apt-get install libpam0g-dev openssl libcrypto++-dev libssl0.9.7 libssl-dev ssh
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Try to find the appropriate packages with yum's search function:
    Code:
    yum search [I]searchstring[/I]
     
  7. dmw555

    dmw555 New Member

    hello

    i im using fc5 with with this rpm installed:
    openssl-devel-0.9.8a-5.2
    openssl-0.9.8a-5.2

    gnu-crypto-2.1.0-1jpp_2fc
    gnu-crypto-javadoc-2.1.0-1jpp_2fc
    libmcrypt-2.5.7-3.fc5
    libgcrypt-1.2.2-1.2.1
    beecrypt-4.1.2-9.2.1
    mcrypt-2.6.4-2.fc5
    cryptsetup-luks-1.0.3-0.rc2
    libgcrypt-devel-1.2.2-1.2.1
    crypto-utils-2.2-9.2.1

    pam_mysql-0.6.2-3.fc5
    pam-devel-0.99.4.0-fc5.4
    pam_passwdqc-1.0.2-1.2.1
    pam_ccreds-3-3.2
    pam-0.99.4.0-fc5.4

    i try search rpm from howto (libpam0g-dev openssl libcrypto++-dev libssl0.9.7 libssl-dev) but don't found it.

    i just remove all ssh rpm's and install
    openssh-4.2p1-chroot.tar.gz
    and chroot ssh working ok

    it's right ?

    which from this (libpam0g-dev openssl libcrypto++-dev libssl0.9.7 libssl-dev)
    necessarily install ?

    thank you.
     
  8. falko

    falko Super Moderator Howtoforge Staff

    If it's working, it's ok. :)
     
  9. seanheng

    seanheng New Member

    still need help with chroot ssh

    i still dont get how you get chroot ssh to work with removing all ssh and installing that file

    what do i need to do?

    how do see what is installed on the system
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Did you read dmw555's post?
     
  11. seanheng

    seanheng New Member

    yes ive read

    hello falko

    yeah i read his post on how he removed all ssh but i dont know how to see what is installed and i used the perfect f5 howto would that interfere with what ive setup using that howto i just need more details on what to do im still learning and need examples i just dont know where to begin
     
  12. falko

    falko Super Moderator Howtoforge Staff

    Run
    Code:
    yum install gnu-crypto gnu-crypto-javadoc libmcrypt libgcrypt ...
    to install those packages.

    Run
    Code:
    rpm -q ssh
    to find out which SSH packages are installed. You can then remove them with
    Code:
    rpm -e [I]packagename[/I]
     
  13. seanheng

    seanheng New Member

    how do i install chrooted ssh

    ok ive followed what you said from the posting and removed all the ssh
    i dont know how to install the chroot ssh into the system
    and do i need to configure it somehow to get it to work right?

    thanks for taking the time to help
     
  14. falko

    falko Super Moderator Howtoforge Staff

    dmw555 wrote it before:

    Have a look at the tutorial. It describes how you install openssh-4.2p1-chroot.tar.gz. :)
     
  15. seanheng

    seanheng New Member

    followed everything

    falko thanks for taking so much time to answer my questions

    ive read the post and removed the openssh rpms and i followed all the tutorial on chroot ssh except the libs part for debian and ive gotten to this part and cant go any further

    hen we do this:

    cp /lib/libnss_compat.so.2 /lib/libnsl.so.1 /lib/libnss_files.so.2 ./lib/
    echo '#!/bin/bash' > usr/bin/groups
    echo "id -Gn" >> usr/bin/groups
    touch etc/passwd
    grep /etc/passwd -e "^root" > etc/passwd

    You should also copy the line of the group in which you will create new users from /etc/group to /home/chroot/etc/group. In this tutorial we will create users in the group users, so we do this:

    grep /etc/group -e "^root" -e "^users" > etc/group

    and restart SSH:

    ---> /etc/init.d/ssh restart

    it says no file or directory
     
  16. seanheng

    seanheng New Member

    managed to get ssh up

    ok managed to get ssh up but heres my problem when i log on with a user it says

    /bin/bash: No such file or directory
     
  17. falko

    falko Super Moderator Howtoforge Staff

    Please check if /bin/bash is within the chroot jail.
     
  18. seanheng

    seanheng New Member

    jailed chroot bin/bash

    falko
    yeah theres is dir bin with file bash in the chroot directory
     
  19. wr19026

    wr19026 New Member

    It works pretty well, until I get to the point where I need to run the script:

    root@bla:/backup/chroot# APPS="/bin/bash /bin/ls /bin/mkdir /bin/mv /bin/pwd /bin/rm /usr/bin/id /usr/bin/ssh /bin/ping /usr/bin/dircolors"
    root@bla:/backup/chroot# for prog in $APPS; do
    > cp $prog ./$prog
    >
    > # obtain a list of related libraries
    > ldd $prog > /dev/null
    > if [ "$?" = 0 ] ; then
    > LIBS=`ldd $prog | awk '{ print $3 }'`
    > for l in $LIBS; do
    > mkdir -p ./`dirname $l` > /dev/null 2>&1
    > cp $l ./$l
    > done
    > fi
    > done
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory
    cp: cannot stat `(0xffffe000)': No such file or directory

    I changed the destination directory to backup/chroot by the way, as I want my users' homedir to be /backup/user1, /backup/user2 etc.

    Any suggestions?
     
  20. seanheng

    seanheng New Member

    tried everything

    ive tried everything i can think of

    like changing dir

    sean:x:500:100:sean:/home/chroot/./chroot/home/sean:/bin/bash

    still doesnt work

    ive set it up like the the posts on here i removed all the rpm of openssh
    and followed the installations of the howto
    created a sshd script to run on /etc/init.d/sshd from the openssh4-2..chroot dir

    everything is running and all but logon as user and theres no /bin/bash
    and they exist in the home/chroot/bin directory

    im clueless
     

Share This Page