aboutsummaryrefslogtreecommitdiff
path: root/scripts/key-check.sh
blob: 1672bc4d93deceea75ef186522646acce27d793d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/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")";