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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. How to Configure Interface(s) in promiscuous mode on CentOS/RHEL 7 (persistently)
  2. lxi: command not found
  3. pwd Command Examples in Linux
  4. CentOS / RHEL : How to create and host yum repository over httpd
  5. How to Restrict Active Directory Users and Groups to Login to CentOS/RHEL 7 Client
  6. “No space left on device” – kdump generation issue (CentOS/RHEL)
  7. What is the difference between & (ampersand) and && (double ampersand) while executing simultaneous commands on Linux
  8. CentOS / RHEL 7 : How to enable or disable automatic updates (via packagekit)
  9. How to Limit/throttle rsync transfer speed in Linux
  10. phar Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright