3

chroot jail 1992 . ?


chroot jail?

Chroot ( change root) - Unix, , .

, chroot, . chroot jail, .


chroot jail?

Chroot jail . , .

chroot jail - . , . .


chroot jail

chroot jail, bash ls.

1. chroot_jail:

mkdir chroot_jail

chroot , :

chroot chroot_jail

bash, chroot . .

2. chroot_jail:

mkdir -p chroot_jail / bin chroot_jail / lib64 / x86_64-linux-gnu chroot_jail / lib / x86_64-linux-gnu 

bash ls.

3. cp which bash ls , .

:

cp $(which ls) chroot_jail/bin/
cp $(which bash) chroot_jail/bin/
. bash ls , . unalias [command], [command] - , .

4. bash ls , chroot_jail/libraries. ldd, , :

ldd $(which bash)
ldd $(which ls)  
ldd

5. lib lib64.

bash:

cp /lib/x86_64-linux-gnu/libtinfo.so.6 chroot_jail/lib/x86_64-linux-gnu/
cp /lib/x86_64-linux-gnu/libdl.so.2 chroot_jail/lib/x86_64-linux-gnu/
cp /lib/x86_64-linux-gnu/libc.so.6 chroot_jail/lib/x86_64-linux-gnu/
cp /lib64/ld-linux-x86-64.so.2 chroot_jail/lib64/

ls:

cp /lib/x86_64-linux-gnu/libselinux.so.1 chroot_jail/lib/x86_64-linux-gnu/
cp /lib/x86_64-linux-gnu/libc.so.6 chroot_jail/lib/x86_64-linux-gnu/
cp /lib/x86_64-linux-gnu/libpcre2-8.so.0 chroot_jail/lib/x86_64-linux-gnu/
cp /lib/x86_64-linux-gnu/libdl.so.2 chroot_jail/lib/x86_64-linux-gnu/
cp /lib64/ld-linux-x86-64.so.2 chroot_jail/lib64/
cp /lib/x86_64-linux-gnu/libpthread.so.0 chroot_jail/lib/x86_64-linux-gnu/  

6. chroot, root chroot_jail:

sudo chroot chroot_jail
sudo chroot chroot_jail
. chroot_jail bash.

ls, :

ls -R
ls -R

7. , :

exit

chroot jail .


50% Merion Academy