What is the output from the cd, pwd, and 1s commands?

Examine the commands used by root to create the chrooted environments in the /jail directory:
# mkdir /jail/bin/jail/lib64
# cp /bin/bash/jail/bin
linux-vdso.so.1 => (0x00007fff68dff000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00000033e00000)
lid1.so.2 => /lib64/libc.so.6 (0x00000033e1600000)
/lib64/id-linix-86-64.so.2 (0x00000033e0e00000)
# cp /lib64/libtinfo.so.5/jail/lib64
# cp /lib64/libd1.so.6 /jail/lib64
# cp /lib64/libc.so.6 /jail/lib64
# cp /lib64/id-linux-x86-64.so.2 /jail/lib64
The user root then issues this command:

# chroot /jail
What is the output from the cd, pwd, and 1s commands?

Examine the commands used by root to create the chrooted environments in the /jail directory:
# mkdir /jail/bin/jail/lib64
# cp /bin/bash/jail/bin
linux-vdso.so.1 => (0x00007fff68dff000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00000033e00000)
lid1.so.2 => /lib64/libc.so.6 (0x00000033e1600000)
/lib64/id-linix-86-64.so.2 (0x00000033e0e00000)
# cp /lib64/libtinfo.so.5/jail/lib64
# cp /lib64/libd1.so.6 /jail/lib64
# cp /lib64/libc.so.6 /jail/lib64
# cp /lib64/id-linux-x86-64.so.2 /jail/lib64
The user root then issues this command:

# chroot /jail
What is the output from the cd, pwd, and 1s commands?

A.
bash-4.1# cd
bash-4.1# pwd
/root
bash-4.1# 1s
bash” 1s: command not found

B.
bash-4.1# cd
bash: cd: /root: No such file or directory
bash-4.1# pwd
/
bash-4.1 # 1s
bash: 1s: command not found

C.
bash-4.1# cd
bash: cd: command not found
bash: pwd: command not found
bash-4.1# 1s

D.
bash: 1s; # cd
bash: cd: /root: unable to access chrooted file or directory /root
bash-4.1# pwd
/
bash-4.1 # 1s
bin lib64

E.
bash-4.1# cd
bash: cd: /root: No such file or directory
bash-4.1# pwd
/
bash-4.1# 1s
bin lib64

Explanation:



Leave a Reply 4

Your email address will not be published. Required fields are marked *


kendl

kendl

B is correct

the tuk-ITE'05 CON-KMITL

the tuk-ITE'05 CON-KMITL

Hi kendl,

Why is B correct?

vasben

vasben

B is correct.

The directory /jail is the root directory of the chrooted environment, so you can’t cd to the chrooted /root becouse the /jail/root directory doesn’t exists, and if you haven’t a home directory, your current path (pwd) is /

The /bin/ls file wasn’t copied to /jail/bin, so the ls command fails with the “command not found” error.

roman

roman

B

[root@xxx jail]# chroot /jail
bash-4.1# cd
bash: cd: /root: No such file or directory
bash-4.1# pwd
/
bash-4.1# ls
bash: ls: command not found
bash-4.1#