Create a system account for the reports service and prevent interactive login.
Which command is appropriate?
useradd -r creates a system account and /usr/sbin/nologin prevents interactive login; grant only required permissions.
Detailed explanation
useradd -m -s /bin/bash reportsIncorrect. It gives a regular home and interactive Bash.
Incorrect. It gives a regular home and interactive Bash.
useradd -u 0 -s /bin/bash reportsIncorrect. UID 0 grants root-level privileges and an interactive shell.
Incorrect. UID 0 grants root-level privileges and an interactive shell.
useradd -r -s /usr/sbin/nologin reportsCorrect. -r creates a system account and nologin denies interactive login.
Correct. -r creates a system account and nologin denies interactive login.
useradd -G sudo reportsIncorrect. A sudo-group membership grants administration and does not block login.
Incorrect. A sudo-group membership grants administration and does not block login.
Try it yourself
An example you can run in a temporary verification environment.
useradd --help 2>&1 | grep -E -- '--system|--shell'Expected result
-r/--systemと-s/--shellの説明Key points
- -r system account
- nologin blocks interactive use
- Do not use UID 0
Notes
- Environment: shadow-utils useradd / help読取のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.