• 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

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. whois: command not found
  2. How to Switch Password Algorithm on CentOS/RHEL
  3. ansible-inventory – Display or dump an Ansible inventory (Command Examples)
  4. How to allow ssh with empty passwords in Linux
  5. How to configure IPtables to open Ports in CentOS / RHEL
  6. bluetoothctl Command Examples in Linux
  7. How to uninstall postgresql-client-common software package in Ubuntu
  8. How to install/get packages from Oracle EPEL Repository on OEL 7
  9. CentOS / RHEL : How To Check FC Brocade HBA Firmware
  10. Secure Shell: Chrome Web Browser ssh client

You May Also Like

Primary Sidebar

Recent Posts

  • diffstat: Create a histogram from the output of the diff command
  • diffoscope: Compare files, archives, and directories
  • diff-pdf: Tool for comparing two PDFs
  • dict: Command line dictionary using the DICT protocol

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright