Remove need to type ssh key each time (assuming you already have a generated ssh key if not see this)
copy to local file to the remote:
scp ~/.ssh/id_rsa.pub email@example.com:~/.ssh/your_computer.pub
then ssh to remote
enter password for the last time
cd ~/.ssh cat your_computer.pub >> authorized_keys rm your_computer.pub exit
One additional note - when you don't want connection to time out see this link.
- Make a passwordless SSH Connection between OSX 10.10 Yosemite and Linux Server
- Example syntax for Secure Copy
Update Dec 9 2015:
Once I accidentaly chown of the .ssh folder, that will prvent ssh keys from working. Also these permissions are required:
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
chmod 700 ~.
From this site
Script I'm using for adding key to remote:
MY_PUB=$(whoami)_$(hostname).pub echo "Authorizing $1" scp ~/.ssh/id_rsa.pub $1:~/$MY_PUB ssh $1 "mkdir -p ~/.ssh; cat ~/$MY_PUB >> ~/.ssh/authorized_keys; rm $MY_PUB;chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys;"