Red Hat Certified System Administrator RHCSA · Free Practice Question Easy

Question 27

On ServerB, create a user sam with a UID of 1500, and ensure that he does not have access to any interactive shell on the system.

  • A

    Pass

  • B

    Fail

Reveal correct answer

Correct answer: A

Explanation

To configure a user with a specific UID and restrict access to an interactive shell, follow these steps:

  1. Create the User:

    • Run the following command to create the user sam with:

      • UID set to 1500

      • Default shell set to /sbin/nologin (restricting interactive access)

    • The option -u 1500 sets the user ID, and -s /sbin/nologin sets a non-interactive shell, preventing the user from logging in interactively.

  2. Verify User Details:

    • Run the following command to display sam's user and group IDs, confirming the correct UID:

    • Additionally, you can check the user entry in the /etc/passwd file to confirm the shell and UID settings:

  3. Attempt to Access sam's Account:

    • To further confirm restricted access, try switching to the sam account:

    • You should see a message indicating that access is denied or that /sbin/nologin restricts the shell.

Explanation:

  • Purpose of /sbin/nologin:

    • The /sbin/nologin shell is commonly used to restrict shell access for system accounts or users who do not need interactive login capabilities. It displays a message denying access if someone tries to log in.

  • Why Set a Specific UID:

    • Assigning a specific UID, like 1500, ensures user management consistency, especially in environments where UID assignments may need to follow organizational standards or unique identification for users.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need