mkpasswd command not found. Install Mkpasswd CentOS

mkpasswd command not found. Install Mkpasswd CentOS 7 / RHEL 7 server

Follow the below steps to install mkpasswd command on your CentOS 7 / Redhat 7 server.


root@server [/]# mkpasswd
-bash: mkpasswd: command not found


I got the above error while trying to generate a new password on my CentOS 7 server. On CentOS / Redhat servers, mkpasswd command is provided by ‘expect’ package.

1. Log into linux server via SSH as root user to install ‘expect’ package

2. You can install expect package using yum command


# yum install expect

root@server [/]# yum install expect
—> Package expect.x86_64 0:5.45-14.el7_1 will be installed

Total download size: 262 k
Installed size: 566 k
Is this ok [y/d/N]:

expect.x86_64 0:5.45-14.el7_1

Now try generating a new password using mkpasswd command.

root@server [/]# mkpasswd

How to Download and install expect rpm on CentOS 7 / RHEL 7 server

1. Log into your CentOS 7 server as ‘root’ user

2. Download expect package from CentOS website using wget command

# wget

3. Install expect rpm using yum command :

# yum install expect-5.45-14.el7_1.x86_64.rpm

yum will install expect package and the required dependencies for expect.

You can also install expect package using rpm command. Before installing you must manually download and install the dependencies.

The below dependencies are required. Dependencies might be already installed on the server so please check before installing.


Note: Install dependencies only if it is not installed.