🔒

Guide to Changing Passwords in Linux✅

Jun 3, 2025

Changing Passwords in Linux

Basic Command for Changing Password

  • To change a password in Linux, use the passwd or password command.

Storage of Passwords

  • When a password is set, it is:
    • Securely scrambled.
    • Stored in a special privileged file: /etc/shadow.
    • This file is readable only by root to prevent unauthorized access.
    • Even with access, passwords cannot be de-scrambled from this file.

Forcing Password Change for Users

  • To force a standard user to change their password:
    • Use the -e or --expire flag with the passwd command.
    • This action will immediately expire a user's password.
    • The user will be required to set a new password on their next login.