← All commands
Topic hub Security & Permissions
Windows Linux Security & Permissions Users & Groups

Windows net user username /passwordreq equivalent in Linux

Sets or changes a user account password.

Windows net user username /passwordreq
Linux equivalents
Debian/Ubuntu same command
passwd
Fedora same command
passwd
Arch same command
passwd

Overview

What this command does

Sets or changes a user account password.

Migration tip: Running passwd with no arguments changes your own password. With sudo passwd username an admin can change anyone's password.

Practical tasks

Common use cases

Change user passwords

Sets or changes a user account password.

passwd

Change your own password

sudo passwd john

Change another user's password

passwd -l john

Lock an account (disable login)

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

passwd
sudo passwd john
sudo passwd -l john
sudo passwd -u john

Walkthrough

Examples with explanations

# Windows: net user john *  (prompts for new password)
passwd                       # change your own password
sudo passwd john            # admin: change john's password
sudo passwd -l john        # lock account (can't log in)
sudo passwd -u john        # unlock account

Reference

Common options and variations

Command or optionUse
passwdChange your own password
sudo passwd johnChange another user's password
passwd -l johnLock an account (disable login)
passwd -u johnUnlock an account
passwd -e johnForce password change on next login

Distro differences

Debian/Ubuntu vs Fedora vs Arch

This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command passwd Same command on this distribution.
Fedora same command passwd Same command on this distribution.
Arch same command passwd Same command on this distribution.

Keep learning

Related Security & Permissions commands