| Tested on | Kali GNU/Linux Rolling 2026.2 (kali-rolling) |
|---|---|
| Package | john 1.9.0-Jumbo-1+git20211102-0kali10john-data 1.9.0-Jumbo-1+git20211102-0kali10 |
| Applies to | Kali Linux |
| Lab environment | Local Kali VM — hashes and ZIP files created in /tmp/john-lab (no remote target required) |
| Privilege | Normal user for cracking; sudo for apt install |
| Scope | Install John the Ripper and john-data with apt, verify build info and supported formats, benchmark CPU speed, crack locally generated SHA-512 and MD5 crypt hashes in wordlist, single, incremental, and rules modes, pause and restore sessions, and audit ZIP and SSH private key passwords with zip2john and ssh2john. Does not cover every john-data converter, GPU Hashcat workflows, live login brute force, or cracking third-party dumps without authorization. |
| Related guides | Pentest lab setup |
John the Ripper (JtR) recovers plaintext passwords from hashes and protected files. After you collect hashes in an ethical hacking lab, John is a common next step to prove weak credentials exist.
This guide installs John on Kali with apt, builds small lab hash files under /tmp/john-lab, and walks through wordlist, rules, single, incremental, session restore, and ZIP cracking. For WPA handshake PMK precomputation on captured PCAPs, pair these hash workflows with install Pyrit on Kali in authorized Wi-Fi labs. Every command and output below was captured on that layout.
/etc/shadow files, customer databases, or downloaded dumps without permission.
What is John the Ripper in ethical hacking?
John automates password guessing against stored hashes. You supply a hash file (or extract one with helpers such as zip2john), John picks candidates from a wordlist, single-mode heuristics, or incremental brute force, hashes each candidate with the same algorithm, and compares the result to the stored hash.
Login systems store passwords as one-way hashes, not plaintext. Linux shadow entries often use SHA-512 crypt ($6$…). ZIP archives use a different format that zip2john converts into a line John can attack. John loads each username:hash line, detects the hash type, and runs the matching algorithm. When a candidate plaintext produces the same hash, John records the crack and you can print it with john --show.
That is distinct from:
- Live login brute force against SSH or web forms (see SSH brute force for online guessing)
- SQL injection or other application-layer bypasses
- GPU-only workflows where Hashcat is the better fit
On Kali, the john package ships the core cracker plus zip2john, unshadow, and other hash extractors. The examples below use hashes you generate locally so the walkthrough is reproducible without touching a production shadow file.
Install John the Ripper on Kali Linux
Kali ships John in its repositories. If the tools are missing or you want the packaged Jumbo build, install with apt and confirm the binary before you build lab hash files.
Update indexes and install the john and john-data packages:
sudo apt update
sudo apt install -y john john-dataOn a system where John is already installed, apt reports the current version and finishes without changes:
john is already the newest version (1.9.0-Jumbo-1+git20211102-0kali10).
Summary:
Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 816Confirm both packages are on the system:
dpkg-query -W john john-datajohn 1.9.0-Jumbo-1+git20211102-0kali10
john-data 1.9.0-Jumbo-1+git20211102-0kali10john-data adds charset definitions and extra converter scripts; the core john package already includes common helpers such as zip2john and ssh2john on Kali.
Run john with no hash file to print the version banner:
john 2>&1 | head -3John the Ripper 1.9.0-jumbo-1+bleeding-aec1328d6c 2021-11-02 10:45:52 +0100 OMP [linux-gnu 64-bit x86_64 AVX2 AC]
Copyright (c) 1996-2021 by Solar Designer and others
Homepage: https://www.openwall.com/john/Print build and path details with --list=build-info:
john --list=build-info 2>&1 | head -8Version: 1.9.0-jumbo-1+bleeding-aec1328d6c 2021-11-02 10:45:52 +0100
Build: linux-gnu 64-bit x86_64 AVX2 AC OMP
SIMD: AVX2, interleaving: MD4:3 MD5:3 SHA1:1 SHA256:1 SHA512:1
System-wide exec: /usr/lib/john
System-wide home: /usr/share/john
Private home: ~/.john
CPU tests: AVX2
CPU fallback binary: john-xop-ompThe Private home: ~/.john line is where John stores the pot file (john.pot), recovery files (*.rec), and session state.
List supported hash formats (truncated — the Jumbo build lists hundreds):
john --list=formats 2>&1 | head -8descrypt, bsdicrypt, md5crypt, md5crypt-long, bcrypt, scrypt, LM, AFS,
tripcode, AndroidBackup, adxcrypt, agilekeychain, aix-ssha1, aix-ssha256,
aix-ssha512, andOTP, ansible, argon2, as400-des, as400-ssha1, asa-md5,
AxCrypt, AzureAD, BestCrypt, BestCryptVE4, bfegg, Bitcoin, BitLocker,
bitshares, Bitwarden, BKS, Blackberry-ES10, WoWSRP, Blockchain, chap,
Clipperz, cloudkeychain, dynamic_n, cq, CRC32, cryptoSafe, sha1crypt,
sha256crypt, sha512crypt, Citrix_NS10, dahua, dashlane, diskcryptor, Django,
django-scrypt, dmd5, dmg, dominosec, dominosec8, DPAPImk, dragonfly3-32,The same package installs helper tools on Kali:
john— main crackerzip2john— extract ZIP password hashesssh2john— extract OpenSSH private key hashesunshadow— combine/etc/passwdand/etc/shadowfor single-mode attacks
The optional Johnny GUI is not installed by default on this Kali image. This guide stays on the CLI; the graphical front end is optional for readers who prefer a desktop workflow.
The default wordlist shipped for John lives at /usr/share/wordlists/john.lst. This walkthrough uses a shorter custom list in /tmp/john-lab so each mode finishes in seconds. Decompress packaged lists before use — rockyou.txt.gz must be gunzipped, not fed to John directly.
Upstream source tarballs and build instructions live on OpenWall. On Kali, apt install john john-data is the supported path unless you deliberately need a custom compile.
Kali lab setup
Create one lab directory, a short wordlist, and hash files you control. Every cracking example below reads from /tmp/john-lab.
Set the lab path and wordlist once:
LAB=/tmp/john-lab
mkdir -p "$LAB"
printf 'password\nroot\nsecret123\nadmin\nSecret123\n' > "$LAB/wordlist.txt"| Item | Value |
|---|---|
| Lab directory | /tmp/john-lab |
| Custom wordlist | $LAB/wordlist.txt (five lines) |
| Default Kali wordlist | /usr/share/wordlists/john.lst (use for larger runs) |
| Session state | ~/.john/*.rec when you use --session |
| Cracked-password store | ~/.john/john.pot (John skips re-cracking entries already in the pot) |
Create hashes with openssl passwd, synthetic passwd/shadow pairs, password-protected ZIP files, or disposable SSH keys — not by copying /etc/shadow from systems you do not administer.
The tool sections below reuse $LAB and wordlist.txt — only the hash file and John mode change.
Understand hash formats
Before you run wordlist mode, read what John loads from each line. A typical Linux shadow entry looks like username:$6$salt$hash, where $6$ marks SHA-512 crypt, the next field is the salt, and the remainder is the derived hash. ZIP and SSH converters produce different line shapes, but the workflow is the same: one hash per line, format-specific algorithm, compare candidates until a match lands in the pot file.
| Concept | What it means in John |
|---|---|
| Format name | Internal label such as sha512crypt or PKZIP — shown in Loaded N password hash (...) |
| Salt | Random per-password input mixed into the hash ($6$labsalt$…) |
| Cost / work factor | Iteration count or KDF strength (SHA-512 crypt defaults to 5000 rounds on this lab) |
| Pot file | ~/.john/john.pot stores cracked plaintext so John does not repeat work |
John auto-detects many formats, but ambiguous lines or mixed hash types in one file can fool detection. When you know the algorithm, pass --format=sha512crypt (or the name from --list=formats) for a more accurate load:
FMT_HASH=$(openssl passwd -6 -salt fmt1 secret123)
printf 'fmtlab:%s\n' "$FMT_HASH" > "$LAB/fmt.txt"
john --wordlist="$LAB/wordlist.txt" --format=sha512crypt "$LAB/fmt.txt"Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
Cost 1 (iteration count) is 5000 for all loaded hashes
secret123 (fmtlab)Use john --show only after a crack attempt completes — it prints plaintext for entries already in the pot file for that hash file.
Compare John the Ripper cracking modes
The sections below follow a practical order: wordlist first, then rules that extend the same list, then single and incremental modes, session restore for long runs, and protected-file converters last.
| Mode | Best for | Typical success signal |
|---|---|---|
| Wordlist | Known weak passwords in a list | plaintext (username) line during the run |
| Rules | Variations such as capitalization | Crack after --rules=Single on a base word |
| Single | Username or GECOS matches password | username (username) after --single |
| Incremental | Short passwords when no wordlist hit | plaintext (username) after --incremental |
| Protected files | ZIP archives and SSH private keys | john --show lists path and password |
Start with wordlist mode on a hash you generated yourself. Add rules when the plaintext is a mutated form of a dictionary word.
Crack hashes with wordlist mode
Wordlist mode hashes each line from your list and compares it to the stored hash. Build a SHA-512 crypt hash for a known lab password, then attack it with the custom wordlist.
Generate a secret123 hash and save it as a John hash file:
HASH=$(openssl passwd -6 -salt labsalt secret123)
printf 'debianlab:%s\n' "$HASH" > "$LAB/hashes.txt"Run John with the lab wordlist:
john --wordlist="$LAB/wordlist.txt" "$LAB/hashes.txt"Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
secret123 (debianlab)
1g 0:00:00:00 DONE (2026-08-02 04:35) 25.00g/s 100.0p/s 100.0c/s 100.0C/s password..adminThe secret123 (debianlab) line is the crack — John matched the hash to plaintext secret123 for user debianlab.
Print cracked passwords reliably with --show:
john --show "$LAB/hashes.txt"debianlab:secret123
1 password hash cracked, 0 leftThat debianlab:secret123 line is what you would paste into a lab report as recovered plaintext.
Apply word mangling rules
Rules mutate wordlist entries — capitalization, suffix digits, and common substitutions. The Jumbo build on Kali includes preset rules such as Single. Run this immediately after wordlist mode when the password is a variant of a base word.
Build a hash for Secret123 and run the wordlist with rules:
RULES_HASH=$(openssl passwd -6 -salt rules1 Secret123)
printf 'ruleslab:%s\n' "$RULES_HASH" > "$LAB/rules.txt"
john --wordlist="$LAB/wordlist.txt" --rules=Single "$LAB/rules.txt"Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
Secret123 (ruleslab)
1g 0:00:00:00 DONE (2026-08-02 04:39) 1.666g/s 426.6p/s 426.6c/s 426.6C/s secret..Secretjjohn --show "$LAB/rules.txt"ruleslab:Secret123
1 password hash cracked, 0 leftRules let one base word in wordlist.txt cover variants John would not try from the raw list alone. Custom rules live in John’s configuration under /etc/john/ on Kali.
Use single crack mode with unshadow
Single mode derives candidates from usernames and GECOS fields in passwd-style files. Combine a minimal passwd and shadow pair with unshadow, set the password equal to the username, and let --single try those patterns.
Create passwd and shadow entries where the password is johndoe:
printf 'johndoe:x:10001:10001:johndoe:/home/johndoe:/bin/bash\n' > "$LAB/passwd"
SINGLE_HASH=$(openssl passwd -6 -salt single1 johndoe)
printf 'johndoe:%s\n' "$SINGLE_HASH" > "$LAB/shadow"
unshadow "$LAB/passwd" "$LAB/shadow" > "$LAB/unshadowed.txt"Run single crack mode on the combined file:
john --single "$LAB/unshadowed.txt"Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
johndoe (johndoe)
1g 0:00:00:00 DONE (2026-08-02 04:35) 20.00g/s 80.00p/s 80.00c/s 80.00C/s johndoe..johndJohn recovered johndoe because single mode tried the username itself as a candidate.
john --show "$LAB/unshadowed.txt"johndoe:johndoe:10001:10001:johndoe:/home/johndoe:/bin/bash
1 password hash cracked, 0 leftOn a real engagement, single mode is most useful after you lawfully obtain passwd and shadow from a compromised host — not by reading /etc/shadow on systems you are not authorized to test.
Run incremental mode
Incremental mode tries character combinations in order. SHA-512 crypt hashes are slow; a lab MD5 crypt hash with a one-character password finishes quickly and shows the same incremental workflow.
Create an MD5 crypt hash for plaintext a:
INC_HASH=$(openssl passwd -1 -salt in1 a)
printf 'shortlab:%s\n' "$INC_HASH" > "$LAB/incremental.txt"Run incremental ASCII mode:
john --incremental=ASCII "$LAB/incremental.txt"Loaded 1 password hash (md5crypt, crypt(3) $1$ (and variants) [MD5 256/256 AVX2 8x3])
a (shortlab)
1g 0:00:00:02 DONE (2026-08-02 04:36) 0.3367g/s 51200p/s 51200c/s 51200C/s jhunds..limJohn found a in about two seconds on MD5 crypt. The same incremental run against SHA-512 shadow hashes can take hours or days for longer passwords — use wordlists and rules first on modern $6$ hashes.
Pause and restore sessions
Long incremental runs can be paused and resumed. Assign a session name, interrupt with Ctrl+C, then run john --restore. John writes recovery data under ~/.john/*.rec; cracked passwords accumulate in ~/.john/john.pot.
Start a named session on a hash John will not crack quickly:
LONG_HASH=$(openssl passwd -6 -salt longsalt verylongpass99)
printf 'slowlab:%s\n' "$LONG_HASH" > "$LAB/slowhash.txt"
john --session=labpause --incremental=ASCII "$LAB/slowhash.txt"Press Ctrl+C when the status line appears. John saves state and prints:
Wait...
Session abortedResume the same session:
john --restore=labpauseLoaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
Proceeding with incremental:ASCII
0g 0:00:00:02 0g/s 256.0p/s 256.0c/s 256.0C/s 123456Proceeding with incremental:ASCII confirms John picked up where the interrupted session left off. Check progress without stopping the run:
john --status=labpause0g 0:00:00:02 0g/s 256.0p/s 256.0c/s 256.0C/s 123456Press Ctrl+C again any time; rerun john --restore=labpause to continue.
Crack protected files with zip2john and ssh2john
Protected files are not shadow lines. The pattern is the same for each format: owned file → converter → hash file → John → verify with --show. This section covers ZIP and OpenSSH private keys; john-data ships additional converters (rar2john, 7z2john, keepass2john, and others) that follow the same flow.
ZIP with zip2john
ZIP passwords are not stored as /etc/shadow lines. Extract a hash line with zip2john, then run the same wordlist attack.
Create a password-protected ZIP in the lab:
printf 'hosts sample\n' > "$LAB/sample.txt"
zip -P secret123 -j "$LAB/protected.zip" "$LAB/sample.txt"Extract the hash into a John input file:
zip2john "$LAB/protected.zip" > "$LAB/zip.hashes"Crack with the lab wordlist:
john --wordlist="$LAB/wordlist.txt" "$LAB/zip.hashes"Loaded 1 password hash (PKZIP [32/64])
secret123 (protected.zip/sample.txt)
1g 0:00:00:00 DONE (2026-08-02 04:35) 33.33g/s 133.3p/s 133.3c/s 133.3C/s password..adminjohn --show "$LAB/zip.hashes"protected.zip/sample.txt:secret123:sample.txt:protected.zip::/tmp/john-lab/protected.zip
1 password hash cracked, 0 leftThe show line names the archive, the password, and the path — enough to open the ZIP with unzip in the lab.
SSH private key with ssh2john
Generate a disposable key with a known passphrase, extract the hash, and attack it the same way:
ssh-keygen -t ed25519 -f "$LAB/labkey" -N "secret123" -q
ssh2john "$LAB/labkey" > "$LAB/ssh.hashes"The hash line is long; the start identifies the key path and format:
/tmp/john-lab/labkey:$sshng$6$16$0fad25d6775643fe208f1425bcf09ed5$274$6f70656e7373682d6b65792d763100...Run John on the extracted line:
john --wordlist="$LAB/wordlist.txt" "$LAB/ssh.hashes"Loaded 1 password hash (SSH, SSH private key [RSA/DSA/EC/OPENSSH 32/64])
secret123 (/tmp/john-lab/labkey)
1g 0:00:00:00 DONE (2026-08-02 07:26) 1.351g/s 6.756p/s 6.756c/s 6.756C/s password..Secret123john --show "$LAB/ssh.hashes"/tmp/john-lab/labkey:secret123
1 password hash cracked, 0 leftDelete "$LAB/labkey" and "$LAB/labkey.pub" when you finish — the key was only for this exercise.
Benchmark John with --test
Before you commit hours to incremental mode, measure how fast John runs on your CPU. john --test benchmarks built-in formats; add --format= to focus on one algorithm such as SHA-512 crypt.
Run the default benchmark suite (truncated — the full run tests every format):
john --test 2>&1 | head -12Will run 2 OpenMP threads
Benchmarking: descrypt, traditional crypt(3) [DES 256/256 AVX2]... (2xOMP) DONE
Warning: "Many salts" test limited: 116/256
Many salts: 705647 c/s real, 783191 c/s virtual
Only one salt: 6775K c/s real, 4170K c/s virtual
Benchmarking: bsdicrypt, BSDI crypt(3) ("_J9..", 725 iterations) [DES 256/256 AVX2]... (2xOMP) DONE
Speed for cost 1 (iteration count) of 725
Many salts: 337161 c/s real, 171115 c/s virtual
Only one salt: 272896 c/s real, 149942 c/s virtualBenchmark SHA-512 crypt alone — the format used in most Linux shadow examples:
john --test --format=sha512crypt 2>&1 | head -5Will run 2 OpenMP threads
Benchmarking: sha512crypt, crypt(3) $6$ (rounds=5000) [SHA512 256/256 AVX2 4x]... (2xOMP) DONE
Speed for cost 1 (iteration count) of 5000
Raw: 714 c/s real, 721 c/s virtualAbout 700 hashes per second on this CPU explains why incremental mode on $6$ shadow entries is slow. Hashcat on a GPU can be faster for large wordlists at scale — neither tool is universally fastest for every format.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
No password hashes loaded |
Wrong file format or path | Use username:hash lines; for shadow work run unshadow passwd shadow |
| Wrong format loaded or crack fails silently | Ambiguous hash line | Set --format=sha512crypt (or the name from john --list=formats) |
| Wordlist mode finds nothing | Password not in the list | Expand the list, add --rules=Single, or try incremental on a weaker hash type in a lab |
| Incremental never finishes or appears stuck | SHA-512 crypt with a long password | Prefer wordlist plus rules; incremental on $6$ hashes is intentionally slow — check rate with john --status |
unknown ciphertext format |
Hash type John does not support | Re-extract with the right helper (zip2john, ssh2john, etc.) or identify with john --list=formats |
fopen: … .rec: No such file |
Session finished or name mismatch | Use the same --session=name you passed originally; check ~/.john/*.rec |
zip2john produces no hash |
Unencrypted ZIP or unsupported method | Recreate with zip -P in the lab; some ZIP encryption modes need a newer archive tool |
ssh2john: command not found |
Converter not installed | sudo apt install john; confirm with which ssh2john |
fopen: … wordlist.txt: No such file |
Wrong path to the wordlist | Confirm $LAB/wordlist.txt exists; use absolute paths in scripts |
fopen: … rockyou.txt or empty guesses |
Wordlist still compressed | Run gzip -d /usr/share/wordlists/rockyou.txt.gz or point at a decompressed file |
John finishes instantly with 0g and no new line |
Hash already in ~/.john/john.pot |
Run john --show on the hash file; for a clean lab retest, use a new salt or username |
| Hash line rejected or odd username | Invalid prefix on hash line | Ensure username:hash with no stray spaces; re-extract with the correct converter |
References
- John the Ripper (OpenWall)
- John the Ripper GitHub repository
- John the Ripper documentation (OpenWall)
Summary
You installed John the Ripper and john-data on Kali with apt, verified build info and supported formats, and benchmarked SHA-512 crypt at roughly 700 hashes per second on this CPU. You cracked locally generated hashes in wordlist, rules, single, and incremental modes, and you understand when explicit --format beats auto-detection.
Wordlist mode recovered secret123 from a SHA-512 crypt line; rules found Secret123 from a capitalized variant; single mode found johndoe when the password matched the username; incremental mode cracked a one-character MD5 crypt password in seconds while SHA-512 hashes remain slow by design.
zip2john and ssh2john plus John opened a lab ZIP and a disposable SSH key protected with secret123. Session names, john --status, and john --restore let you pause long incremental work; the pot file at ~/.john/john.pot stores cracks so John does not repeat completed work.
Use John on authorized hash files and archives only. Pair it with custom wordlists from a wordlist generator or GPU cracking with Hashcat when engagements scale beyond CPU wordlist runs.

