mkpasswd.pl command not found

In this troubleshooting guide we learn how to fix mkpasswd.pl command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

mkpasswd.pl: command not found

or when using sudo you get the following error message

sudo: mkpasswd.pl: command not found

Solutions to mkpasswd.pl: command not found

How To Fix mkpasswd.pl: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu mkpasswd.pl is provided by libstring-mkpasswd-perl package.

libstring-mkpasswd-perl is:

String::MkPasswd defines a single function, mkpasswd(), to generate random passwords. The function is meant to be a simple way for developers and system administrators to easily generate a relatively secure password.

The exportable mkpasswd() function returns a single scalar: a random password. By default, this password is nine characters long with a random distribution of four lower-case characters, two upper-case characters, two digits, and one non-alphanumeric character. These parameters can be tuned by the user, as described in the /“ARGUMENTS” section.

To fix this problem, we can install more using the command below.

sudo apt-get -y install libstring-mkpasswd-perl

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install libstring-mkpasswd-perl.

sudo apt -y install libstring-mkpasswd-perl

Or if you have aptitude installed you can use the following command.

sudo aptitude install libstring-mkpasswd-perl

Summary

In this tutorial we learn how to fix mkpasswd.pl command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.