how to run a command in chroot environment

i have command like simple helloworld print exe i need to run in chroot environment what are the steps i need to follow in Fedora 6
tskishanAsked:
Who is Participating?
 
hugetoonCommented:
In a nutshell you  need to put everything the programm will need in the directory where you whant chroot to.
i.e
- the program itself
- libraries it is linked to
- configuration files
- optionally you'll need to create inodes for devices it will access

Example is attached

Another example of root usage would be to have a whole unix system and run a chrooted shell, I do that often with debian when I don't want to mess with the hosting system.
# ldd /bin/echo
        linux-gate.so.1 =>  (0xb7f28000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7dbe000)
        /lib/ld-linux.so.2 (0xb7f29000)
#mkdir -p /tmp/chroot/lib/
#cd /lib
#cp ld-linux.so.2 libc.so.6 /tmp/chroot/lib/
#cp /bin/echo /tmp/chroot/
#chroot /tmp/chroot ./echo toto
toto

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.