• 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

mkpasswd Command Examples in Linux

by admin

Random passwords for users can be generated using the mkpasswd command (which is included with the expect software package). For example, to generate a 10-character pass-word automatically with three numbers and three digits, use ‘mkpasswd -l 10 -d 3 -C 3’. Good passwords are not birthdays, anniversaries, your pet’s name, the name of your significant other, or the model of your first car!

mkpasswd Command Examples

1. To make a new password:

# mkpasswd

2. To assign a new passwd to user:

# mkpasswd mike

3. To defines the length of the password:

# mkpasswd -l 20

4. To defines the minimum number of digits:

# mkpasswd -d 5

5. To defines the minimum number of lowercase alphabetic characters:

# mkpasswd -c 4

6. To defines the minimum number of uppercase alphabetic characters:

# mkpasswd -C 1

7. To names a program to set the password:

# mkpasswd -p /bin/passwd

8. To causes characters to be chosen so that they alternate between right and left hands:

# mkpasswd -2

9. To causes the password-setting interaction to be visible:

# mkpasswd -v

Filed Under: Linux

Some more articles you might also be interested in …

  1. doctl kubernetes options: Provides values available for use with doctl’s Kubernetes commands
  2. lpr Command Examples
  3. kak Command Examples
  4. setpci command – configure PCI device
  5. quotacheck Command Examples in Linux
  6. qemu does not launch : vnc server started
  7. mkswap: command not found
  8. laravel-zero Command Examples
  9. chpasswd : command not found
  10. httpflow Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright