• 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 Examples in Linux

by admin

The passwd command is used to either set the user’s initial password or modify the user’s existing password. The syntax of the passwd command is as follows:

$ passwd [username]

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.

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. Common NFS mount options in Linux
  2. chown Command Examples in Linux
  3. How to connect to an Active Directory Domain using Realmd (Configure CentOS/RHEL 7 as active directory client)
  4. How to Configure Network Interface Teaming in CentOS/RHEL 7 and 8
  5. What is the difference between insmod and modprobe
  6. How to debug systemd boot process in CentOS/RHEL 7 and 8
  7. How to change the NIC device name in CentOS / RHEL 6
  8. Comparing NET-TOOLS V/s IPROUTE Package Commands (ip Vs ifconfig command comparison)
  9. How to calculate recommended value of vm.min_free_kbytes Kernel Tuning Parameter
  10. lvremove Command Fails With Error “LVM – Can’t remove open logical volume”

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright