#!/bin/bash
#
# Preate a public/private key for passwordless logins from the current
# machine.
#
# usage: ssh-key.sh

PRIVATE_KEY="$HOME/.ssh/id_rsa"
CONFIG_FILE="$HOME/.ssh/config"
HOST=$(hostname -f)

echo "use a long and difficult-to-guess passphrase"
ssh-keygen -t rsa -f "$PRIVATE_KEY" || exit 1
cat > "$CONFIG_FILE" <<EOF
Host $HOST
        IdentityFile $PRIVATE_KEY
EOF
echo "run ssh-remote.sh to configure a remote host"
echo "run ssh-prime.sh on each login to prime the agent"

exit 0
