Re: question of chroot
[email protected] (Bob Proulx) Sat, 11 Jan 2003 11:04:20 -0700
| Newsgroups | gmane.comp.gnu.sh-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
mydownload my <[email protected]> [2003-01-12 00:12:18 +0800]: > I am a linux user.I want to ask a question about "chroot". > When I use "chroot" command(for example:chroot /root),a error display: > chroot: cannot execute /bin/bash: No such file or directory Run COMMAND with root directory set to NEWROOT. If no command is given, run ``${SHELL} -i'' (default: /bin/sh). The chroot command changes the root of your filesystem to the specified location. If you are not specifying a command then the default is /bin/sh. chroot /root Is equivalent to: chroot /root /bin/sh -i Do you have a file '/root/bin/sh' and all of the shared libraries and support filesystem needed to allow that to work? One would not normally create a filesystem at /root. That is a terrible location for that purpose. The chroot command has very specific behavior which people can use for many different purposes. Such as creating an area for another operating system on the same disk as your present operating system. You can chroot to the other system and perform testing and other uses. If you wanted to create a chroot area, here is one method. As one example, once in this area one could update their operating system components in the chroot, without affecting the outer filesystem, and experiment with new commands and functionality. For example, if one of my install packages had a really bad bug and did 'rm -rf /' this would only affect the chroot area and my underlying system hosting it would be unaffected. mkdir -p /chrootarea cp -av /bin /dev /etc /home /lib /root /sbin /tmp /usr /var /chrootarea/ chroot /chrootarea su - But don't confuse the idea of a chroot area as a security area. Root processes in the chroot area can easily escape the chroot jail. Bob