0
0
Linux CLIscripting~5 mins

/etc/passwd and /etc/shadow in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the /etc/passwd file in Linux?
The /etc/passwd file stores basic information about user accounts, such as username, user ID, group ID, home directory, and default shell. It is readable by all users.
Click to reveal answer
beginner
Why is the /etc/shadow file separated from /etc/passwd?
The /etc/shadow file stores encrypted user passwords and related security information. It is kept separate and readable only by the root user to protect password security.
Click to reveal answer
intermediate
What kind of information does each line in /etc/passwd contain?
Each line has 7 fields separated by colons: username, password placeholder (usually 'x'), user ID (UID), group ID (GID), user info (comment), home directory, and default shell.
Click to reveal answer
intermediate
Who can read the /etc/shadow file and why?
Only the root user or processes with root privileges can read /etc/shadow because it contains sensitive encrypted password data that must be protected from unauthorized access.
Click to reveal answer
intermediate
How does Linux use /etc/passwd and /etc/shadow together during login?
Linux uses /etc/passwd to find user details and /etc/shadow to verify the encrypted password during login. This separation improves security by limiting password exposure.
Click to reveal answer
Which file contains the encrypted passwords in a Linux system?
A/etc/shadow
B/etc/passwd
C/etc/group
D/etc/login
What does the 'x' in the password field of /etc/passwd indicate?
AUser has no password
BPassword is stored in /etc/shadow
CUser account is locked
DPassword is empty
Who can read the /etc/passwd file by default?
ANo one
BOnly users in the admin group
COnly root user
DAll users
What is the main reason for separating password data into /etc/shadow?
ATo protect password security by restricting access
BTo speed up login
CTo allow users to edit their passwords
DTo store user groups
Which field in /etc/passwd specifies the user's default shell?
AFirst field
BThird field
CSeventh field
DSixth field
Explain the roles of /etc/passwd and /etc/shadow files in Linux user management.
Think about what info is public and what needs protection.
You got /4 concepts.
    Describe the typical fields found in a line of /etc/passwd and their meanings.
    There are seven fields separated by colons.
    You got /7 concepts.