Created
March 14, 2021 12:22
-
-
Save yemreak/f6b7696720759f737d259d04bb389b09 to your computer and use it in GitHub Desktop.
Creates SSH connection with unique ecdsa key and store it remote server (Linux & Mac)
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
#!/usr/bin/bash | |
read -p 'Username: ' USER | |
read -p 'IP adress: ' IP | |
read -p 'Key ID: : ' KEY_ID | |
# SSH key oluşturma | |
KEY_PATH="$HOME/.ssh/${KEY_ID}-ecdsa" | |
ssh-keygen -t ecdsa -b 521 -f ${KEY_PATH} | |
# SSH keyi sunucuya kopyalama ve yetkilendirme | |
ADDRESS=$USER@$IP | |
ssh-copy-id -i $KEY_PATH.pub $ADDRESS | |
# SSH keyi yerel anahtarlara ekleme (eğer şifre istenirse anahtar eklenmeli) | |
ssh-add $KEY_PATH | |
# SSH ile adrese bağlanma | |
ssh $ADDRESS -A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment