An administrator wants to create a chroot environment for a potentially compromised service. The service needs to read /etc/resolv.conf and /etc/hosts, and run from a directory /chroot/service. Which of the following steps is essential to ensure the chroot environment is secure and functional?
Device files are required for many system calls; without them, the service may crash or hang.
Why this answer
A chroot environment typically lacks device nodes, and many services require /dev/null and /dev/random for basic I/O operations and entropy. Without these, the service may fail to start or behave unpredictably. Creating them with mknod ensures the service can function securely within the jail.
Exam trap
The trap here is that candidates assume copying binaries and configs is sufficient, overlooking the need for device nodes that are part of the filesystem but not present in a minimal chroot.
How to eliminate wrong answers
Option A is wrong because setting the chroot directory read-only would prevent the service from writing logs, temporary files, or runtime data, breaking functionality; chroot jails are not inherently read-only. Option B is wrong because mounting /proc is not essential for reading /etc/resolv.conf and /etc/hosts; /proc is needed for process information but not for the stated file access. Option C is wrong because copying only binaries and configuration files ignores the need for device nodes like /dev/null and /dev/random, which are required by many services for standard I/O and random number generation.