[Webinar] Learn how to a build a cloud-first strategyRegister Now


how to run a command in chroot environment

Posted on 2009-02-10
Medium Priority
Last Modified: 2012-05-06
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
Question by:tskishan
1 Comment

Accepted Solution

hugetoon earned 2000 total points
ID: 23608880
In a nutshell you  need to put everything the programm will need in the directory where you whant chroot to.
- 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

Open in new window


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question