what is mkpasswd command with its examples

It is a command which is used to generate encrypted passwords or password hashes. Which is commonly used for generating password hashes that can be stored in password-related files, such as /etc/passwd or /etc/shadow.

  • About mkpasswd: To generate new password, optionally apply it to a user
  • It comes from “expect-5.44.1.15” package.
  • Configuration Files:
  • Path: /usr/bin/mkpasswd

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

Leave a Reply

Your email address will not be published. Required fields are marked *