how to run a command in chroot environment

Posted on 2009-02-10
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
    LVL 4

    Accepted Solution

    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
   =>  (0xb7f28000)
   => /lib/i686/cmov/ (0xb7dbe000)
            /lib/ (0xb7f29000)
    #mkdir -p /tmp/chroot/lib/
    #cd /lib
    #cp /tmp/chroot/lib/
    #cp /bin/echo /tmp/chroot/
    #chroot /tmp/chroot ./echo toto

    Open in new window


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now