100% Latest & Updated LPI 102-500 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 20
A nonprivileged user runs a custom tool named audit, but the wrong executable in an earlier PATH directory is chosen. Select THREE measures that follow directly from the root cause and lifecycle risk.
- Use shell syntax checks and a controlled small fixture before rolling out looping probes.
- Use type -a audit and command -v audit to inspect every candidate and the selected path.
- Inspect the generated record and confirm it contains the evaluated short hostname.
- Join the marker action to the backup command using && or an explicit zero-status if test.
- Avoid untrusted writable directories ahead of system binaries in PATH.
- Put the approved executable directory before the conflicting directory or invoke its absolute path.
Explanation
Correct Answers
B:Use type -a audit and command -v audit to inspect every candidate and the selected path. This check is tied to the expected behavior rather than mere process uptime.
E:Avoid untrusted writable directories ahead of system binaries in PATH. This control detects or prevents the same mechanism before another incident.
F:Put the approved executable directory before the conflicting directory or invoke its absolute path. This is appropriate because Command lookup follows the order of directories in PATH, not the newest version of an executable.
Incorrect Answers
A:This option assumes In POSIX shell the loop body must be between do and done to repeat each operation. The reported symptoms instead call for: Put the approved executable directory before the conflicting directory or invoke its absolute path.
C:The script passes a command name as text instead of performing command substitution. That describes a different fault. Here, Command lookup follows the order of directories in PATH, not the newest version of an executable.
D:A semicolon executes the next command regardless of the earlier command's exit code. That describes a different fault. Here, Command lookup follows the order of directories in PATH, not the newest version of an executable.
Question 21
Multiple users need a system-wide environment setting, but editing one account's ~/.bashrc changes only that account. What underlying Linux behavior should the administrator identify first?
- An unquoted empty expansion removes an argument from the test expression.
- The script passes a command name as text instead of performing command substitution.
- Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution.
- Per-user Bash startup files cannot reliably configure all login users across the host.
Explanation
Correct Answer
D:Per-user Bash startup files cannot reliably configure all login users across the host. This is the explanation that justifies the specific remedy: Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
Incorrect Answers
A:That choice responds to a avoid globbing in scalar tests failure. In this incident, Per-user Bash startup files cannot reliably configure all login users across the host.
B:The script passes a command name as text instead of performing command substitution. could help with capture command output safely; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Test fresh login shells for two different accounts and inspect the exported variable.
C:This option assumes Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. The reported symptoms instead call for: Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
Question 22
Multiple users need a system-wide environment setting, but editing one account's ~/.bashrc changes only that account. What should the administrator do to correct this behavior?
- Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
- Use read -r target and validate target before acting on it.
- Place the network probe inside a for loop with a properly bounded sequence and do/done.
- Quote "$file" at each use and iterate safely over properly expanded pathnames.
Explanation
Correct Answer
A:Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement. It addresses the root cause, while Maintain global login configuration centrally rather than copying account-specific dotfiles. reduces future recurrence.
Incorrect Answers
B:This belongs to read input instead of hardcoding, where Prompt text alone does not read standard input into a shell variable. The current issue instead is: Per-user Bash startup files cannot reliably configure all login users across the host.
C:Place the network probe inside a for loop with a properly bounded sequence and do/done. could help with loop over ordered sequence; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Test fresh login shells for two different accounts and inspect the exported variable.
D:This option assumes Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. The reported symptoms instead call for: Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
Question 23
Multiple users need a system-wide environment setting, but editing one account's ~/.bashrc changes only that account. Which observation should be used for acceptance testing?
- Test fresh login shells for two different accounts and inspect the exported variable.
- Log each expected host ID and verify all four are tested once.
- Provide two different test inputs and confirm the selected host changes accordingly.
- Simulate primary success and failure separately and verify recovery runs only for failure.
Explanation
Correct Answer
A:Test fresh login shells for two different accounts and inspect the exported variable. This check is tied to the expected behavior rather than mere process uptime.
Incorrect Answers
B:The test for loop over ordered sequence would be: Log each expected host ID and verify all four are tested once. The relevant acceptance check here is: Test fresh login shells for two different accounts and inspect the exported variable.
C:It would address read input instead of hardcoding rather than the present problem. The appropriate correction here is: Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
D:That choice responds to a conditional recovery on failure failure. In this incident, Per-user Bash startup files cannot reliably configure all login users across the host.
Question 24
Multiple users need a system-wide environment setting, but editing one account's ~/.bashrc changes only that account. Which ongoing control would best reduce the chance of the issue returning?
- Standardize IFS= read -r for line-oriented scripts handling untrusted text.
- Validate user input and handle EOF explicitly before destructive administrative operations.
- Maintain global login configuration centrally rather than copying account-specific dotfiles.
- Gate success-side effects on checked exit statuses instead of command order alone.
Explanation
Correct Answer
C:Maintain global login configuration centrally rather than copying account-specific dotfiles. Sustained checks matter because Per-user Bash startup files cannot reliably configure all login users across the host.
Incorrect Answers
A:That choice responds to a read lines without mangling backslashes failure. In this incident, Per-user Bash startup files cannot reliably configure all login users across the host.
B:Validate user input and handle EOF explicitly before destructive administrative operations. could help with read input instead of hardcoding; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Test fresh login shells for two different accounts and inspect the exported variable.
D:This belongs to successful command chaining, where A semicolon executes the next command regardless of the earlier command's exit code. The current issue instead is: Per-user Bash startup files cannot reliably configure all login users across the host.
Question 25
Multiple users need a system-wide environment setting, but editing one account's ~/.bashrc changes only that account. Choose TWO case-specific steps: one that fixes the issue and one that proves the result.
- Force the backup program to fail and verify the marker file is not created.
- Test fresh login shells for two different accounts and inspect the exported variable.
- Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
- Ban setuid shell-script designs in security reviews and test execution paths under least privilege.
- Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
Explanation
Correct Answers
B:Test fresh login shells for two different accounts and inspect the exported variable. The test is evidence-based because the underlying failure was: Per-user Bash startup files cannot reliably configure all login users across the host.
C:Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement. The change should be accepted only after this test: Test fresh login shells for two different accounts and inspect the exported variable.
Incorrect Answers
A:Force the backup program to fail and verify the marker file is not created. belongs to a situation where A semicolon executes the next command regardless of the earlier command's exit code. Here the evidence supports a different requirement: Test fresh login shells for two different accounts and inspect the exported variable.
D:It would address script permissions and suid expectations rather than the present problem. The appropriate correction here is: Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
E:This belongs to avoid globbing in scalar tests, where An unquoted empty expansion removes an argument from the test expression. The current issue instead is: Per-user Bash startup files cannot reliably configure all login users across the host.
Question 26
An administrator edits ~/.bashrc for one account and expects every new user to inherit it, but newly created homes do not. Which diagnosis is supported by the observations?
- Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution.
- The special parameter $? reports the immediately preceding command's exit status, and echo overwrote it.
- The script passes a command name as text instead of performing command substitution.
- New home-directory defaults come from the configured skeleton directory, not an existing user's home.
Explanation
Correct Answer
D:New home-directory defaults come from the configured skeleton directory, not an existing user's home. This is the explanation that justifies the specific remedy: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
Incorrect Answers
A:That choice responds to a preserve spaces in file paths failure. In this incident, New home-directory defaults come from the configured skeleton directory, not an existing user's home.
B:It would address exit status after a failing command rather than the present problem. The appropriate correction here is: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
C:This option assumes The script passes a command name as text instead of performing command substitution. The reported symptoms instead call for: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
Question 27
An administrator edits ~/.bashrc for one account and expects every new user to inherit it, but newly created homes do not. Which configuration approach is appropriate for this requirement?
- Run narrowly scoped privileged operations through a reviewed sudo policy or a dedicated privileged service instead.
- Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
- Place the network probe inside a for loop with a properly bounded sequence and do/done.
- Use read -r target and validate target before acting on it.
Explanation
Correct Answer
B:Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled. It is the direct response; verify the result by: Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user.
Incorrect Answers
A:Linux generally ignores setuid elevation on interpreter scripts because it is unsafe. That describes a different fault. Here, New home-directory defaults come from the configured skeleton directory, not an existing user's home.
C:This belongs to loop over ordered sequence, where In POSIX shell the loop body must be between do and done to repeat each operation. The current issue instead is: New home-directory defaults come from the configured skeleton directory, not an existing user's home.
D:Use read -r target and validate target before acting on it. belongs to a situation where Prompt text alone does not read standard input into a shell variable. Here the evidence supports a different requirement: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
Question 28
An administrator edits ~/.bashrc for one account and expects every new user to inherit it, but newly created homes do not. Which observation should be used for acceptance testing?
- Inspect the generated record and confirm it contains the evaluated short hostname.
- Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user.
- Test with a filename containing whitespace and confirm each file is processed once.
- Exercise the condition with 9, 10 and 12 and inspect its exit status.
Explanation
Correct Answer
B:Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user. This measures the specific result of applying: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
Incorrect Answers
A:Inspect the generated record and confirm it contains the evaluated short hostname. belongs to a situation where The script passes a command name as text instead of performing command substitution. Here the evidence supports a different requirement: Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user.
C:This belongs to preserve spaces in file paths, where Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. The current issue instead is: New home-directory defaults come from the configured skeleton directory, not an existing user's home.
D:That choice responds to a numeric comparison in sh failure. In this incident, New home-directory defaults come from the configured skeleton directory, not an existing user's home.
Question 29
An administrator edits ~/.bashrc for one account and expects every new user to inherit it, but newly created homes do not. What longer-term control best supports this requirement?
- Include filenames with whitespace and glob characters in automated script regression tests.
- Add an example of expected expansion to the script's acceptance tests.
- Version-control skeleton templates and test new-account provisioning rather than mutating active homes.
- Place exit-status capture adjacent to the command it evaluates.
Explanation
Correct Answer
C:Version-control skeleton templates and test new-account provisioning rather than mutating active homes. Sustained checks matter because New home-directory defaults come from the configured skeleton directory, not an existing user's home.
Incorrect Answers
A:Include filenames with whitespace and glob characters in automated script regression tests. could help with preserve spaces in file paths; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user.
B:The script passes a command name as text instead of performing command substitution. That describes a different fault. Here, New home-directory defaults come from the configured skeleton directory, not an existing user's home.
D:This option assumes The special parameter $? reports the immediately preceding command's exit status, and echo overwrote it. The reported symptoms instead call for: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
Question 30
An administrator edits ~/.bashrc for one account and expects every new user to inherit it, but newly created homes do not. Select THREE measures that follow directly from the root cause and lifecycle risk.
- Execute the script directly under the production launcher and verify it runs with Bash semantics.
- Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
- Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user.
- Test both branches of operational recovery scripts with controlled return codes.
- Version-control skeleton templates and test new-account provisioning rather than mutating active homes.
- Use IFS= read -r line inside a controlled while loop.
Explanation
Correct Answers
B:Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled. Unlike a broad workaround, it targets the observed cause: New home-directory defaults come from the configured skeleton directory, not an existing user's home.
C:Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user. It verifies that the targeted action (Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.) achieved its intended outcome.
E:Version-control skeleton templates and test new-account provisioning rather than mutating active homes. It makes the outcome of the targeted repair (Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.) repeatable.
Incorrect Answers
A:A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. That describes a different fault. Here, New home-directory defaults come from the configured skeleton directory, not an existing user's home.
D:Test both branches of operational recovery scripts with controlled return codes. belongs to a situation where The fallback lacks a failure condition, so it executes on the successful path as well. Here the evidence supports a different requirement: Version-control skeleton templates and test new-account provisioning rather than mutating active homes.
F:Use IFS= read -r line inside a controlled while loop. belongs to a situation where The read builtin normally treats backslashes as escapes unless -r is supplied. Here the evidence supports a different requirement: Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
LPI Level 1 (102-500) Practice Tests