• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

passwd: command not found

by admin

The passwd command is used by root to set or reset a password for any user. A user can use the passwd command themselves to reset their own password. It is also used to set the initial password for a user after creating the account with the useradd command.

Note: The screen will not show any output when a user is setting a password. Some users will mistake this for a problem, but it is actually Linux hiding the number of characters being used in the password.

The syntax of the passwd command is:

$ passwd [user name]

where [user name] can be used by root to set a specific user’s password.

The root user can set the password for any user to any value without knowing his current password. As a regular user, simply type the command at the CLI. You’ll see something like this in response:

$ passwd
Changing password for geek.
Old Password:

Once you’ve entered the old password, you’re asked for the new one, and then asked to repeat it. If you enter the same new password twice, it’s changed. It looks like this. Note that the actual passwords you’ve typed do not show up on the screen.

New password:
Re-enter new password:
Password changed.

If you encounter below error while running the passwd command:

passwd: command not found

you may try installing the passwd package as shown below as per your choice of distribution.

Distribution Command
Debian apt-get install passwd
Ubuntu apt-get install passwd
Arch Linux pacman -S passwd
Kali Linux apt-get install passwd
CentOS yum install passwd
Fedora dnf install passwd
Raspbian apt-get install passwd

passwd command examples

1. To lock the user account:

# passwd -l geek

2. To unlock the user account:

# passwd -u geek

3. To delete the password for the user account:

# passwd -d geek

4. To expire the password for the user account:

# passwd -e geek

5. To set the min / max password life

# passwd -n 10 geek
# passwd -x 100 geek

6. To set warning message time:

# passwd -w 2 geek

7. To set the user account inactivity time:

# passwd -i 20 geek

8. To get the short info about user account passwd:

# passwd -S geek

Filed Under: Linux

Some more articles you might also be interested in …

  1. dbus-daemon: command not found
  2. brittany: Pretty-print Haskell source files
  3. ncview: command not found
  4. mountpoint Command Examples in Linux
  5. cpufreq-aperf: command not found
  6. mkfs.btrfs: command not found
  7. bpftrace Command Examples in Linux
  8. macof: command not found
  9. encfs: Mounts or creates encrypted virtual filesystems
  10. virt-manager: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright