Hello,
I often create new keys to connect to various build/destroy systems. So I've scripted it (below). But this only sets it up for a specific user on that remote machine. I'm not sure how/if you can set it to work for any user. If that's what you need then I'd recommend discussing it with your linux/unix admin.
script:
#!/bin/bash
if [[ -z $1 ]]; then {
read -a SERVERNAME -p "servername: "
} else {
SERVERNAME=$1
}
fi
if [[ -z $2 ]]; then {
read -a USERNAME -p "username: "
} else {
USERNAME=$2
}
fi
#echo #Step1 - run on remote server.
#ssh $USERNAME@$SERVERNAME 'mkdir ~/.ssh'
#echo ""
#echo #Step2 - run on your local computer.
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -C "Key for ssh"
fi
#echo ""
#echo #Step3 - run on your local computer
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
#echo ""
#echo #Step4 - run on your local computer (against the remote server)
cat ~/.ssh/id_rsa.pub | ssh $USERNAME@$SERVERNAME 'mkdir ~/.ssh; cat - >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh'
#echo ""
#echo #Step5 - run on your local computer (against the remote server)
#ssh $USERNAME@$SERVERNAME 'chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh'
#echo ""
#echo #Step6 - echo connection string (rather mouse clicks than type :))
#echo ""
echo ssh $USERNAME@$SERVERNAME
#echo ""
Regards,
Gregg