Implemented grow and seed

This commit is contained in:
Kevin Veen-Birkenbach 2020-10-15 13:38:45 +02:00
parent 7adf94bc5f
commit 8c8e3de775
1 changed files with 16 additions and 0 deletions

16
grow-and-seed.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# @param $1 Host
if [ -z "$1" ]
then
echo "Hostname needs do be defined";
exit 1;
fi
target_host=$1 &&
ssh_file="$HOME/.ssh/$(date '+%Y%m%d')_$USER@$HOSTNAME""_to_$1""_id_rsa" &&
ssh-keygen -C "$USER@$HOSTNAME for $1 - Created at $(date '+%Y%m%d%H%M%S')" -b 4096 -t rsa -f "$ssh_file" &&
ssh-copy-id -i "$ssh_file" "$target_host" &&
echo "Growed and seeded ssh-key." &&
echo "Keep in mind to remove all unauthorized keys." &&
echo "You can do this by executing:" &&
echo "scp $ssh_file.pub $target_host:.ssh/authorized_keys" &&
exit