-
-
Save aduzsardi/adf0d2282213e3607c71e8695c2707ae to your computer and use it in GitHub Desktop.
my keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Adauga key-ile ssh sysadmini in 'authorized_keys' al utilizatorului cu care rulat | |
# 'curl keys.mydomain.com | bash' | |
# Adauga key-a ssh in lista de mai jos | |
KEYS=" | |
# -- Sysadmins SSH Keys -- | |
# - user 'sysadmin' va fi folosit in viitor pentru chestii de administrare & monitorizare pe VM-uri | |
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAA... sysadmin@odin | |
# - aduzsardi rsa key | |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9f0D4QM8Y3KHnZg15nV39OmsTSSRz5k8tcPljX8Rk5dYHTda3lyNT... aduzsardi@home | |
# - aduzsardi ecdsa key | |
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGe= alexandru.duzsardi@home | |
# -- Sysadmins SSH Keys -- | |
" | |
authorized_keys="${HOME}/.ssh/authorized_keys" | |
echo "Adaug key-ile ssh pentru root login" | |
if [[ -a "$authorized_keys" ]]; then | |
echo "Fisierul '$authorized_keys' exista" | |
echo "Adaug key-ile ssh" | |
echo "$KEYS" >> "$authorized_keys" | |
else | |
echo "Fisierul '$authorized_keys' nu exista" | |
echo "Creez fisierul acum" | |
mkdir ${HOME}/.ssh; chmod 700 ${HOME}/.ssh | |
echo "Adaug key-ile ssh" | |
echo "$KEYS" > "$authorized_keys" | |
chmod 600 "$authorized_keys" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment