1

Was trying to create a minimal chroot jail.

The steps followed was:

  1. Created a folder chroot
  2. Copied bash to the folder chroot
  3. Run ldd bash to know the dependencies

    ldd /bin/bash   linux-vdso.so.1 =>  (0x00007fff645e2000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f9155f75000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9155d71000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f91559e6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f91561bb000)
    
  4. Then I created folder like

    ls chroot/
    
    bash  lib  lib64
    
    ls chroot/lib
    
    x86_64-linux-gnu
    
  5. When I run

    chroot chroot/
    
    chroot: failed to run command `/bin/bash': No such file or directory
    
2
  • 1
    Put your bash to chroot/bin/
    – user37607
    Commented Nov 5, 2013 at 6:50
  • @RistoSalminen K
    – user3539
    Commented Nov 5, 2013 at 8:51

1 Answer 1

2

As the error message says, chroot tries to run chroot/bin/bash (/bin/bash inside chroot), but it is not able to run it because your bash is in chroot/ (/ inside chroot). Therefore the solution is to put your bash to chroot/bin/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .