#!/bin/sh # Check for a public key, and create one for the user if it # does not exist. Spit the key in red to stdout. Not so much for me, # but as a convienient script to give to others who aren't so familiar # with how SSH key authorization works. keyf="$HOME/.ssh/id_ed25519"; ! [ -e "$keyf" ] && ssh-keygen -t ed25519 -f "$keyf" -P ""; printf '\033[1;31m%s\033[0m\n' "$(cat "$keyf.pub")"; # One line version for pasting into chat: # keyf="$HOME/.ssh/id_ed25519"; ! [ -e "$keyf" ] && ssh-keygen -t ed25519 -f "$keyf" -P ""; printf '\033[1;31m%s\033[0m\n' "$(cat "$keyf.pub")";