ssh chrooted

Discussion in 'Server Operation' started by unkn0wn, May 8, 2006.

  1. unkn0wn

    unkn0wn New Member

    zlib-1.2.3# make
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o example.o example.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o adler32.o adler32.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o compress.o compress.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o crc32.o crc32.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o gzio.o gzio.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o uncompr.o uncompr.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o deflate.o deflate.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o trees.o trees.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o zutil.o zutil.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o inflate.o inflate.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o infback.o infback.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o inftrees.o inftrees.c
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -c -o inffast.o inffast.c
    gcc -shared -Wl,-soname,libz.so.1 -o libz.so.1.2.3 adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
    rm -f libz.so libz.so.1
    ln -s libz.so.1.2.3 libz.so
    ln -s libz.so.1.2.3 libz.so.1
    gcc -fPIC -O3 -DNO_vsnprintf -DUSE_MMAP -o example example.o -L. libz.so.1.2.3
    /usr/lib/libc_nonshared.a(elf-init.oS)(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0): In function `__i686.get_pc_thunk.bx':
    : multiple definition of `__i686.get_pc_thunk.bx'
    example.o(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0): first defined here
    collect2: ld returned 1 exit status
    make: *** [example] Error 1


    for zlib.
    i follow howto from howtoforge.
     
  2. falko

    falko Super Moderator

    Which distribution do you use? What's the output of
    Code:
    uname -m
    ?
     
  3. unkn0wn

    unkn0wn New Member

    debian sarge 3.1
    uname -m
    i686
     
  4. falko

    falko Super Moderator

    Did you run
    Code:
    ./configure
    before
    Code:
    make
    ?

    What's the output of
    Code:
    ./configure --help
    ?
     
  5. unkn0wn

    unkn0wn New Member

    /zlib-1.2.3# ./configure
    Checking for gcc...
    Building static library libz.a version 1.2.3 with gcc.
    Checking for unistd.h... Yes.
    Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
    Checking for vsnprintf() in stdio.h... Yes.
    Checking for return value of vsnprintf()... Yes.
    Checking for errno.h... Yes.
    Checking for mmap support... Yes.


    and that it
     
  6. unkn0wn

    unkn0wn New Member

    ii menage it but i wanna apt libcrypto and have a new error :)

    Do you want to continue? [Y/n] y
    Get:1 ftp://ftp.hu.debian.org testing/main libpam0g 0.79-3.1 [79.0kB]
    Get:2 ftp://ftp.hu.debian.org testing/main libpam0g-dev 0.79-3.1 [117kB]
    Fetched 196kB in 12s (15.2kB/s)
    dpkg: syntax error: unknown group `Debian-exim' in statusoverride file
    E: Sub-process /usr/bin/dpkg returned an error code (2)


    wtf with that group
     
  7. falko

    falko Super Moderator

    Looks like an error of the package maintainers. Seems as if these packages depend on Exim...
     
  8. unkn0wn

    unkn0wn New Member

    i just add group debian-exim in /etc/group and its work.
    Problem is i had one sshd from regular debian instalation after
    install of chrooted sshd services are down :)
     
  9. unkn0wn

    unkn0wn New Member

    i made new init script and start new sshd chrooted and its ok :)
    but user testuser cant log in its says:

    Code:
    
    Password:
    /bin/bash: No such file or directory
    Connection to localhost closed.
    
    i copy bin in /home/chroot

    ls /home/chroot/
    bin dev etc home lib sc usr


    ls /home/chroot/bin/
    bash ls mkdir mv ping pwd rm


    entry in /etc/passwd

    testuser:x:1003:100:testuser:/home/chroot/./home/testuser:/bin/bash
     
  10. falko

    falko Super Moderator

    Is /home/chroot/bin/bash executable?
     
  11. unkn0wn

    unkn0wn New Member

    stat /home/chroot/bin/bash
    File: `/home/chroot/bin/bash'
    Size: 625228 Blocks: 1230 IO Block: 4096 regular file
    Device: 306h/774d Inode: 306012 Links: 1
    Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 50/ staff)
    Access: 2006-05-11 23:14:45.000000000 +0200
    Modify: 2006-05-11 22:29:17.000000000 +0200
    Change: 2006-05-11 22:29:17.000000000 +0200
     
  12. unkn0wn

    unkn0wn New Member

    wtf :) i can exec bin bash but over ssh nope
    when i su to testuser i can enter /bin /usr/bin where i want...i dont wanna this to happen

    $ echo $HOME
    /home/chroot/./home/testuser
     
    Last edited: May 12, 2006
  13. falko

    falko Super Moderator

    Does /home/chroot/home/testuser exist?
     
  14. unkn0wn

    unkn0wn New Member

    yes its exist

    ls -al /home/chroot/home/testuser
    total 6
    drwxr-xr-x 2 testuser users 1024 May 11 22:30 .
    drwxr-sr-x 3 root staff 1024 May 10 10:40 ..
    -rw------- 1 testuser users 377 May 12 12:46 .bash_history
    -rw-r--r-- 1 testuser users 567 May 10 10:40 .bash_profile
    -rw-r--r-- 1 testuser users 1834 May 10 10:40 .bashrc
     
  15. falko

    falko Super Moderator

    Hm.... Strange... :confused:
     
  16. unkn0wn

    unkn0wn New Member

    i know :(
    i follow instructions and everything look ok but
    i cant log in.
     
  17. unkn0wn

    unkn0wn New Member

    maybe its problem in libs? i seen some erros when i execute your script.

    /home/chroot/lib# ls
    libacl.so.1 libncurses.so.5 libnss_compat.so.2 tls
    libattr.so.1 libnsl.so.1 libnss_files.so.2


    this is libs
     

Share This Page