Skip to content

Instantly share code, notes, and snippets.

@yemreak
Last active July 7, 2020 08:23
Show Gist options
  • Save yemreak/1f6a1be32fa024d91f60e55cfc565921 to your computer and use it in GitHub Desktop.
Save yemreak/1f6a1be32fa024d91f60e55cfc565921 to your computer and use it in GitHub Desktop.
🔑 SSH key oluşturma ve sunucuya aktarma scripti (🐧 Linux)
#!/usr/bin/bash
read -p 'Username: ' USER
read -p 'IP adress: ' IP
read -p 'Key ID: : ' KEY_ID
KEY_PATH="./.ssh/${KEY_ID}_ecdsa"
ssh-keygen -t ecdsa -b 521 -f ${KEY_PATH}
ssh ${USER}@${IP} "\
mkdir -p ~/.ssh && \
echo \"`cat ${KEY_PATH}.pub`\" && \
chmod 700 ~/.ssh && \
chmod 600 ~/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment