openwall / openwall/john

Add environment variable to control John’s home directory (XDG Base Directory support)

Open
#5,841 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement RFC / discussion
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Summary

John the Ripper currently hardcodes ~/.john as the per-user “home” (JOHN_PRIVATE_HOME in params.h), with $JOHN as a partial override. This setup does not comply with the XDG Base Directory Specification and gives users little flexibility in where files are stored.

The problem is not whether to default to ~/.john or to XDG — it’s that the path is compiled in and not fully user-configurable.


Proposal

Introduce a new environment variable (e.g. JOHN_HOME) that defines the base directory for all user-specific files (config, pot, session, recovery, etc).

This would allow:

  • JOHN_HOME=$XDG_DATA_HOME/john
  • JOHN_HOME=$HOME/.local/state/john
  • JOHN_HOME=$HOME/.john (legacy)

In other words, users control the layout without recompiling or symlink hacks.

Additionally:

  • Preserve the current behavior if JOHN_HOME is unset (fall back to ~/.john).

Benefits
  • User Choice: Users who want strict XDG compliance can set it in their shell profile. Those who prefer the legacy layout don’t need to change anything.

  • Distribution-friendly: Packagers (Arch, Debian, etc.) can enable XDG layouts without patching params.h.

  • No breakage: Existing scripts and installs continue to work unchanged.

  • Simple to implement: Replace the constant JOHN_PRIVATE_HOME with a getenv() check, e.g.:

    const char *john_home = getenv("JOHN_HOME");
    if (!john_home)
        john_home = "~/.john";
    

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in params.h, where JOHN_PRIVATE_HOME is defined, then trace its references across configuration, pot, session, and recovery file handling. Verify that the new environment variable controls all user-specific paths while the existing ~/.john behavior remains unchanged when it is unset.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.