Courseiva
User and Group ManagementmediumMultiple SelectObjective-mapped

LFCS User and Group Management Practice Question

A Linux administrator wants to restrict user 'alice' to only be able to use the system for non-interactive tasks (e.g., running cron jobs and receiving mail) but not allow her to log in via SSH or console. Which TWO actions would achieve this goal? (Choose two.)

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Set alice's login shell to /sbin/nologin in /etc/passwd.

Sets alice's shell to /sbin/nologin, which prevents interactive logins (console, SSH, etc.) but still allows non-interactive tasks like cron jobs and mail delivery because those do not require a login shell. Option C adds alice to the DenyUsers directive in sshd_config, which blocks all SSH access regardless of authentication method (password or key). Together, these two measures ensure alice cannot log in interactively but can still run cron jobs and receive mail. Option A locks the password but does not prevent SSH key-based login. Option D gives root privileges. Option E blocks cron, which is not desired.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Lock alice's password with 'passwd -l alice'.

    Why it's wrong here

    Does not block SSH key authentication.

  • Set alice's login shell to /sbin/nologin in /etc/passwd.

    Why this is correct

    Prevents interactive login without affecting cron/mail.

  • Add alice to the DenyUsers directive in /etc/ssh/sshd_config.

    Why this is correct

    Blocks SSH login only.

  • Change alice's UID to 0.

    Why it's wrong here

    Gives root privileges; does not block logins.

  • Add alice to /etc/cron.deny.

    Why it's wrong here

    Blocks cron, which is not desired.

About these practice questions

This LFCS question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.