Comandos de la terminal/chroot

De WikiCabal
Ir a la navegación Ir a la búsqueda

chroot

[root@Llawyr mnt]# mkdir /usr/chroot

[root@Llawyr mnt]#  cd /usr/chroot

[root@Llawyr chroot]#  mkdir bin etc lib64 var home

[root@Llawyr chroot]#  ldd /bin/bash
	linux-vdso.so.1 (0x00007fff7bc62000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f47880f1000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f4787eed000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f4787b38000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f478831b000)

[root@Llawyr chroot]# cp /lib64/libtinfo.so.5 /usr/chroot/lib64
[root@Llawyr chroot]# cp /lib64/libdl.so.2 /usr/chroot/lib64
[root@Llawyr chroot]# cp /lib64/libc.so.6 /usr/chroot/lib64
[root@Llawyr chroot]# cp /lib64/ld-linux-x86-64.so.2 /usr/chroot/lib64
[root@Llawyr chroot]# cp /usr/bin/bash /usr/chroot/bin

[root@Llawyr chroot]#  chroot /usr/chroot
[I have no name!@Llawyr /]# pwd
/

[I have no name!@Llawyr /]#  ls
bash: ls: command not found

[I have no name!@Llawyr /]# exit
exit

[root@Llawyr chroot]#  ldd /bin/ls
	linux-vdso.so.1 (0x00007fff987fe000)
	libcap.so.2 => /lib64/libcap.so.2 (0x00007feb3a338000)
	libacl.so.1 => /lib64/libacl.so.1 (0x00007feb3a12f000)
	libc.so.6 => /lib64/libc.so.6 (0x00007feb39d7a000)
	libattr.so.1 => /lib64/libattr.so.1 (0x00007feb39b75000)
	/lib64/ld-linux-x86-64.so.2 (0x00007feb3a53d000)

[root@Llawyr chroot]# cp /lib64/libcap.so.2 lib64/
[root@Llawyr chroot]# cp /lib64/libacl.so.1 lib64/
[root@Llawyr chroot]# cp /lib64/libc.so.6 lib64/
cp: overwrite ‘lib64/libc.so.6’? n
[root@Llawyr chroot]# cp /lib64/libattr.so.1 lib64/
[root@Llawyr chroot]# cp /lib64/ld-linux-x86-64.so.2 lib64/
cp: overwrite ‘lib64/ld-linux-x86-64.so.2’? n
[root@Llawyr chroot]# cp /usr/bin/ls bin

[root@Llawyr chroot]#  chroot /usr/chroot

[I have no name!@Llawyr /]# /bin/ls -al
total 32
drwxr-xr-x 8 0 0 4096 May  9 18:11 .
drwxr-xr-x 8 0 0 4096 May  9 18:11 ..
drwxr-xr-x 2 0 0 4096 May  9 18:16 bin
drwxr-xr-x 2 0 0 4096 May  9 18:10 etc
drwxr-xr-x 2 0 0 4096 May  9 18:10 home
drwxr-xr-x 2 0 0 4096 May  9 18:10 lib
drwxr-xr-x 2 0 0 4096 May  9 18:16 lib64
drwxr-xr-x 2 0 0 4096 May  9 18:10 var

[I have no name!@Llawyr /]#exit

[root@Llawyr chroot]#  chroot /usr/chroot /bin/ls -al
total 32
drwxr-xr-x 8 0 0 4096 May  9 18:11 .
drwxr-xr-x 8 0 0 4096 May  9 18:11 ..
drwxr-xr-x 2 0 0 4096 May  9 18:16 bin
drwxr-xr-x 2 0 0 4096 May  9 18:10 etc
drwxr-xr-x 2 0 0 4096 May  9 18:10 home
drwxr-xr-x 2 0 0 4096 May  9 18:10 lib
drwxr-xr-x 2 0 0 4096 May  9 18:16 lib64
drwxr-xr-x 2 0 0 4096 May  9 18:10 var
[root@Llawyr chroot]#