Home · Guides / 3

Guide 3 of 5

Use a custom .onion address

If you generated keys with mkp224o, replace the default hostname Tor created in guide 1.

Swap in the vanity keys

  1. Note the current hostname in case you still want it.

    cd /var/lib/tor/hidden_service/
    cat hostname
    cat hostname showing the default generated .onion address
    The default address Tor created on first start.
  2. Remove or move the old keys if you are switching address.

    cd /var/lib/tor/hidden_service/
    sudo rm -rf *
    This is destructive Once the keys are gone, the old .onion address cannot be recovered. Copy them somewhere safe first if you might need them.
    Empty hidden_service directory after removing the old keys
    The hidden service directory after the default keys are removed.
  3. Find the generated key folder.

    cd /home/<your username>/Downloads/mkp224o/<key folder name>/<key folder>/

    Example:

    cd /home/user/Downloads/mkp224o/websitekeys/websitehz44l75xucojrrqofi4v7rn4y75wu6ocn7zbwjazgr44prfyd.onion/
    ls -al
    Listing hs_ed25519 public and secret key files in a vanity onion folder
    The vanity key set ready to copy.
  4. Copy the keys into the hidden service directory.

    sudo cp * /var/lib/tor/hidden_service/
    Copying vanity onion keys into /var/lib/tor/hidden_service
    Keys copied to Tor’s hidden service path.
  5. Give ownership to the Tor service account.

    sudo chown debian-tor:debian-tor /var/lib/tor/hidden_service/*
    chown debian-tor applied to files in the hidden service directory
    Tor must own the key files to read them.
  6. Restart Tor.

    sudo service tor restart
    sudo service tor restart after installing custom keys
    After restart, cat hostname should show the vanity address.