In Linux, user passwords are not stored directly in the /etc/passwd
file,
which contains basic user account information but is world-readable and does
not hold actual password data. Instead, encrypted user passwords are stored in
the /etc/shadow
file, which is accessible only by the root user or
authorized system processes for security reasons
. The /etc/shadow
file contains hashed and salted passwords using
cryptographic algorithms such as MD5, SHA-256, or SHA-512, depending on the
Linux distribution and configuration. This hashing makes it computationally
infeasible to reverse-engineer the original password from the stored hash
. To summarize:
- User account info: stored in
/etc/passwd
(readable by all users) - Encrypted password hashes: stored in
/etc/shadow
(readable only by root) - Passwords are stored as salted cryptographic hashes, not plaintext
- Common hashing algorithms include SHA-512 by default in modern distributions
This separation and encryption mechanism enhances Linux system security by protecting user passwords from unauthorized access