I am trying to automate setting up Private Key Authentication for SSH.
Not sure how to achieve my desired result. I need to look stdin line by line into a file.
key(){
read -p "Paste Your Private Key Here: " privatekey
while read $privatekey; do
echo $privatekey > ~/.ssh/id_rsa;
done
chmod 600 ~/.ssh/id_rsa
chown work:work ~/.ssh/id_rsa
echo "Your SSH Key Authentication is setup!"
}
Can someone assist with this?
Thanks!