nerdexam
LPI

102-500 · Question #85

What is true about the file .profile in a user's home directory?

The correct answer is E. It must be readable for its owner only. Option E captures the one genuine requirement: .profile is sourced (read) by the login shell using the . built-in, so the shell process-running as the owner-must be able to read it. If the file is unreadable, the login shell silently skips it and the user's environment is never…

Shells and Shell Scripting

Question

What is true about the file .profile in a user's home directory?

Options

  • AIt must be executable.
  • BIt must call the binary of the login shell.
  • CIt must use a valid shell script syntax.
  • DIt must start with a shebang.
  • EIt must be readable for its owner only.

How the community answered

(35 responses)
  • B
    6% (2)
  • C
    14% (5)
  • D
    3% (1)
  • E
    77% (27)

Explanation

Option E captures the one genuine requirement: .profile is sourced (read) by the login shell using the . built-in, so the shell process-running as the owner-must be able to read it. If the file is unreadable, the login shell silently skips it and the user's environment is never configured; executable permission plays no role here.

Why the distractors are wrong:

  • A (must be executable): Wrong because sourcing a file (source .profile / . .profile) only requires read permission-the shell interprets the contents itself rather than launching a new process.
  • B (must call the login shell binary): Wrong; .profile sets environment variables and runs startup commands using the already-running shell-it never needs to invoke a shell binary.
  • C (must use valid shell syntax): While invalid syntax causes errors, the file can still exist and be partially processed; there is no hard "must be valid" gate enforced before sourcing begins.
  • D (must start with a shebang): Wrong; shebangs (#!/bin/bash) are only meaningful when the kernel executes a file directly. Sourced files ignore the shebang line entirely.

Memory tip: Link .profile to the word profile-you read someone's profile, you don't run it. That reminds you the file needs read permission, not execute, and a shebang is useless without execution.

Topics

#shell-configuration#file-permissions#login-shells#security

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice