GSEC · Question #242
You work as a Network Administrator for Secure World Inc. The company has a Linux-based network. You want to run a command with the changed root directory. Which of the following commands will you…
The correct answer is B. chroot <new root> <command>. The 'chroot' command runs a command or shell with a specified directory as the new root directory, isolating the process from the real filesystem root. This is commonly used for sandboxing and system recovery tasks.
Question
You work as a Network Administrator for Secure World Inc. The company has a Linux-based network. You want to run a command with the changed root directory. Which of the following commands will you use?
Options
- Als <new root> <command>
- Bchroot <new root> <command>
- Croute <new root> <command>
- Dchdir <new root> <command>
How the community answered
(23 responses)- A9% (2)
- B78% (18)
- C13% (3)
Why each option
The 'chroot' command runs a command or shell with a specified directory as the new root directory, isolating the process from the real filesystem root. This is commonly used for sandboxing and system recovery tasks.
'ls' is a directory listing command and has no ability to change the root directory or execute another command with a modified filesystem view.
The 'chroot <new root> <command>' syntax changes the apparent root directory to the specified path and then executes the given command within that confined environment. This is the standard Linux utility designed specifically for running processes with an alternative root directory, which is frequently used in security sandboxing, chroot jails, and system rescue scenarios.
'route' is used to view and manipulate the IP routing table and has no functionality related to changing the root directory for command execution.
'chdir' (or 'cd') changes the current working directory for the shell session, not the root directory, and it does not execute an arbitrary command in that context.
Concept tested: chroot command for changing root directory
Source: https://man7.org/linux/man-pages/man8/chroot.8.html
Topics
Community Discussion
No community discussion yet for this question.