Difference between revisions of "Chroot"
Jump to navigation
Jump to search
(Created page with "# Using chroot /bin/bash depends of course on libc, ld-linux, libdl etc., you can use ldd /bin/bash to see which libraries it requires. 1) You can mount -o bind these direc...") |
|||
Line 5: | Line 5: | ||
1) You can mount -o bind these directories under chroot 2) Or you can copy these libraries to chroot, if you don't trust the chrooted env to not corrupt them, like so: | 1) You can mount -o bind these directories under chroot 2) Or you can copy these libraries to chroot, if you don't trust the chrooted env to not corrupt them, like so: | ||
+ | ``` | ||
cp main rootfs/ | cp main rootfs/ | ||
cp -a /usr rootfs/ | cp -a /usr rootfs/ | ||
Line 13: | Line 14: | ||
chroot --userspec=test1:test1 ./rootfs /main | chroot --userspec=test1:test1 ./rootfs /main | ||
+ | ``` |
Revision as of 15:12, 17 May 2020
Using chroot
/bin/bash depends of course on libc, ld-linux, libdl etc., you can use ldd /bin/bash to see which libraries it requires.
1) You can mount -o bind these directories under chroot 2) Or you can copy these libraries to chroot, if you don't trust the chrooted env to not corrupt them, like so:
cp main rootfs/ cp -a /usr rootfs/ cp -a /lib rootfs/ cp -a /lib64 rootfs/ chmod rootfs chroot --userspec=test1:test1 ./rootfs /main