mirror of
https://github.com/kevinveenbirkenbach/grow-and-seed-ssh-key.git
synced 2024-11-23 18:31:04 +01:00
Implemented grow and seed
This commit is contained in:
parent
7adf94bc5f
commit
8c8e3de775
16
grow-and-seed.sh
Normal file
16
grow-and-seed.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user