How to crack linux passwords with John the Ripper



Photo by regularguy.eth on Unsplash

John the Ripper is an application built to crack passwords. In this article, we will crack some insecure linux passwords using this tool. We will walk through all the steps, from installation all the way to actually cracking the passwords. Remember to make sure you have permission to crack any passwords! This article is for educational purposes only.

Installation

Firstly, we want to navigate to https://www.openwall.com/john/ to download our version of the application. We want to scroll down to the section titled “Download the latest John the Ripper core release”.

From here, we can download the tar.xz file to our system. This will download a tar.xz archive.

Move this to the directory you want to work in, and extract it by double clicking or running:

tar -xf tar.xz

Now, John the Ripper is installed on our system and we can set it up to crack some passwords.

Setup

First, move to the source folder and run the make command to see a list of target systems.

cd src
make

Choose the correct target for your system. Usually for linux this will be linux-x86-64 and for mac it is usually macosx-x86-64 but this can change depending on your system.

Using this target, run the following command, replacing with your system’s target:

make clean <TARGET>

This will create the requited executables for John the Ripper under /run .

Move to the run directory with cd ../run and test that John the Ripper is working properly:

./john --test

This may take a minute, but should run a benchmarking test and ensure that everything is working correctly.

Once this has completed, we’re ready to crack some passwords!

Cracking passwords

The first step for cracking passwords is having some to crack. Linux passwords can be found encrypted in the /etc/shadow file. To attempt to crack these passwords, create a copy of the file and move it to the folder you want to use. Replace <path> with the path to your folder:

sudo cp /etc/shadow ~/<path>/passwd

This will create a new file called passwd with the contents of your shadow file. From here, navigate to the /run directory where you downloaded John the Ripper and run the program, once again replacing <path> with the path to your folder:

./john --show ~/<path>/passwd

This will run John the Ripper and attempt to crack the passwords. With any luck, you should see the cracked passwords displayed on your terminal!