Back to the command reference

passwd

UsersBeginner In real Linux

Change a password

Name: passwd = password

This command needs a real Linux system; you can practise it in real Linux mode.

Full man page

Description

passwd changes passwords. Ordinary users change only their own and must give the old one; root can change anyone's, lock accounts and force expiry. Hashes are stored in /etc/shadow.

Syntax

passwd [OPTION]... [USER]

Common options

-l / -uLock / unlock the account
-d / --deleteRemove the password (logging in needs none; careful)
-e / --expireForce a change at next login
-x / --maxdays DAYSDays a password stays valid
-S / --statusShow password status

Examples

  • $ passwd

    Change your own password

    Explain
  • $ sudo passwd alice

    Change another user's password

    Explain

Related