mkpasswd Command Examples in Linux

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
Related Post