Create and manage Tor relays on Ubuntu 24.04 or Debian 13.
# Copy example config
cp relay-config.csv.example relay-config.csv
nano relay-config.csv # Edit with your values
# Generate hashed password
tor --hash-password YourPasswordHere
# Create relays (with parameters)
sudo ./create-relays.sh --password "16:YOUR_HASH_HERE" --torrc /path/to/torrc.all
# Or short form
sudo ./create-relays.sh -p "16:YOUR_HASH_HERE" -t /path/to/torrc.all
# Or interactive mode (prompts for password)
sudo ./create-relays.sh
# Verify
./verify-relays.shFormat: nickname,lan_ip,wan_ip,or_port,control_port,metrics_port
First relay: All fields required
Following relays: Only nickname,wan_ip required (ports auto-increment)
relay01,192.168.1.100,203.0.113.100,443,13001,35001
relay02,,203.0.113.101,,,
relay03,,203.0.113.102,,,create-relays.sh- Create relays (auto-detects Ubuntu/Debian)verify-relays.sh- Verify systemmanage-relays.sh- Daily managementsetup-family.sh- Configure Tor 0.4.9.x Happy Family (local or remote via SSH)
Platform compatibility: Scripts auto-detect and work on both Ubuntu 24.04 and Debian 13.
./manage-relays.sh status # Show status
./manage-relays.sh summary # Show IPs/ports
./manage-relays.sh export # Export to CSV
./manage-relays.sh logs <nickname> # View logs
./manage-relays.sh restart <nickname> # Restart relay
./manage-relays.sh list # List allExport to CSV: ./manage-relays.sh export > relays.csv
Per relay:
- User:
_tor-<nickname> - Config:
/etc/tor/instances/<nickname>/torrc - Data:
/var/lib/tor-instances/<nickname>/ - Service:
tor@<nickname>.service
Shared: /etc/tor/torrc.all (from $HOME/torrc.all)
Cryptographic family keys replace the O(n²) MyFamily lists.
Requires Tor >= 0.4.9.1-alpha on all relay servers.
./setup-family.sh generate --name myfamilySave the output — you'll need the FamilyId and the .secret_family_key file.
If you have the key file locally (from step 1 or a backup):
./setup-family.sh deploy-remote \
--key <filename>.secret_family_key \
--family-id "<FamilyId from step 1>" \
--remote <server> --ask-sudo-passLost your FamilyId? Re-run generate with the key file in the same directory — it reads the existing key and prints the FamilyId without overwriting.
If the key is already on another server (pull it first, then deploy):
./setup-family.sh import-key-remote --remote existing-server --ask-sudo-pass
./setup-family.sh deploy-remote \
--key <filename>.secret_family_key \
--family-id "<FamilyId from import output>" \
--remote new-server --ask-sudo-passUse --servers servers.txt instead of --remote for multiple servers at once.
./setup-family.sh status-remote --remote myserver --ask-sudo-pass--ask-sudo-passprompts once and relays the password to the remote server. Not needed if the SSH user is root or has passwordless sudo.--remotetargets one server.--servers servers.txttargets many (one per line).- The script respects
~/.ssh/config— use Host aliases in place of IPs. - Run
./setup-family.sh --helpfor all commands and options.
# Check logs
sudo journalctl -u tor@<nickname>.service -n 50
# Verify config
sudo -u _tor-<nickname> tor --verify-config -f /etc/tor/instances/<nickname>/torrc
# System check
./verify-relays.sh