newbie chroot problem

From: apollo (apollo_at_OlympusNews.com)
Date: 08/18/05


Date: Thu, 18 Aug 2005 12:57:25 -0400

Using CentOS 4.1 (RHEL equivalent) as root with bash as my shell, I
reviewed the man pages and info for chroot, did ldd for /bin/bash, and
got the following:

# ldd /bin/bash
         libtermcap.so.2 => /lib/libtermcap.so.2 (0x00d77000)
         libdl.so.2 => /lib/libdl.so.2 (0x00c98000)
         libc.so.6 => /lib/tls/libc.so.6 (0x00b48000)
         /lib/ld-linux.so.2 (0x00b2f000)
[root@localhost /]#

So I then created the following directory setup:

# ls -Ral /crtest
/crtest:
total 24
drwxr-xr-x 3 root root 4096 Aug 18 12:25 .
drwxr-xr-x 26 root root 4096 Aug 18 12:48 ..
drwxr-xr-x 4 root root 4096 Aug 18 12:22 crtest

/crtest/crtest:
total 32
drwxr-xr-x 4 root root 4096 Aug 18 12:22 .
drwxr-xr-x 3 root root 4096 Aug 18 12:25 ..
drwxr-xr-x 2 root root 4096 Aug 18 12:23 bin
drwxr-xr-x 3 root root 4096 Aug 17 17:15 lib

/crtest/crtest/bin:
total 780
drwxr-xr-x 2 root root 4096 Aug 18 12:23 .
drwxr-xr-x 4 root root 4096 Aug 18 12:22 ..
-rwxr-xr-x 1 root root 772760 Feb 17 20:30 bash

/crtest/crtest/lib:
total 168
drwxr-xr-x 3 root root 4096 Aug 17 17:15 .
drwxr-xr-x 4 root root 4096 Aug 18 12:22 ..
-rwxr-xr-x 1 root root 93256 Jun 9 20:40 ld-2.3.4.so
lrwxrwxrwx 1 root root 11 Aug 18 12:48 ld-linux.so.2 -> ld-2.3.4.so
-rwxr-xr-x 1 root root 11168 Jun 9 20:40 libdl-2.3.4.so
lrwxrwxrwx 1 root root 14 Aug 18 12:48 libdl.so.2 -> libdl-2.3.4.so
lrwxrwxrwx 1 root root 19 Aug 18 12:48 libtermcap.so.2 ->
libtermcap.so.2.0.8
-rwxr-xr-x 1 root root 10884 Feb 21 14:55 libtermcap.so.2.0.8
drwxr-xr-x 2 root root 4096 Aug 17 17:10 tls

/crtest/crtest/lib/tls:
total 1216
drwxr-xr-x 2 root root 4096 Aug 17 17:10 .
drwxr-xr-x 3 root root 4096 Aug 17 17:15 ..
-rwxr-xr-x 1 root root 1212936 Jun 9 20:40 libc-2.3.4.so
lrwxrwxrwx 1 root root 13 Aug 18 12:48 libc.so.6 -> libc-2.3.4.so
[root@localhost /]#

Then, when I try chroot /crtest I get:

# chroot /crtest
chroot: cannot run command `/bin/bash': No such file or directory
[root@localhost /]#

Obviously, I am missing something here.

Any help appreciated.

Thanks

Apollo



Relevant Pages

  • newbie chroot problem
    ... Using CentOS 4.1 as root with bash as my shell, ... # ldd /bin/bash ... So I then created the following directory setup: ... when I try chroot /crtest I get: ...
    (linux.redhat)
  • newbie chroot problem
    ... Using CentOS 4.1 as root with bash as my shell, ... # ldd /bin/bash ... So I then created the following directory setup: ... when I try chroot /crtest I get: ...
    (comp.os.linux.misc)
  • newbie chroot problem
    ... Using CentOS 4.1 as root with bash as my shell, ... # ldd /bin/bash ... So I then created the following directory setup: ... when I try chroot /crtest I get: ...
    (comp.os.linux)
  • newbie chroot problem
    ... Using CentOS 4.1 as root with bash as my shell, ... # ldd /bin/bash ... So I then created the following directory setup: ... when I try chroot /crtest I get: ...
    (alt.os.linux)
  • Re: SFTP only
    ... You can chroot SSH by applying a patch to the OpenSSH source and the rebuilding. ... You still have to run ldd to identify the needed files and copy those to the chrooted environment. ... SFTP, but again they can still navigate the filesystem. ...
    (SSH)