LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chroot query. (https://www.linuxquestions.org/questions/linux-newbie-8/chroot-query-603207/)

uncle-c 11-29-2007 05:01 AM

chroot query.
 
I found this example of chroot usage and was wondering if anyone could kindly answer my question in order for me to understand the command and its workings.

Quote:


this isn't the only way to change the root password on a system.

This way kind of mixes both of the methods described on this page:

You can boot using a LiveCD, then via a root terminal, you can chroot into your system after mounting it:


sudo su
mkdir /mnt/hd
mount /dev/hda2 -t ext3 /mnt/hd
chroot /mnt/hd
passwd

Once you've filled in your password, it's done. Your root password is changed.
So once you've chrooted to a system you are using the commands found on that system and not the commands on your liveCD ? For example if there is a binary called hello.world in the system's /usr/bin directory I could execute that if I was chrooted into the system ?
Would "breaking out" of the above chroot simply involve unmouting the system ? One could easily carry on unaware that the system in chrooted and then wonder why certain commands which are housed on liveCD are not able to run.


Thanks again,
Uncle.

aus9 11-29-2007 07:29 AM

You have a quoted one main use of a live cd.

On RIP live cd....you issue "exit' command to terminate the chroot environment and then and only then can you umount the relevant hard drive partition.

by defination, a person in chroot can not umount what is currently mounted....they can only work from within their new set of rules....the chroot environment knows nothing about the fact you mounted some partition under /mnt/hd or /zzzzzk.....it all looks like / to it.

To repeat you can not break out....except on a live cd...try exit.

2) what you are probably thinking about is chroot jails on hard drive systems
http://www.bpfh.net/simes/computing/chroot-break.html


All times are GMT -5. The time now is 04:54 AM.