How to create a password-less ssh login

How to create a password-less ssh login
based on: http://arctic.org/~dean/rdiff-backup/unattended.html

#log in as the user
host=server.com
hostnick=server
luser=localusername
suser=serverusername
#
mkdir -p .ssh
ssh-keygen -t rsa -f .ssh/id_rsa_$hostnick #generate key
############# You will be prompted for a password, press enter for no pw
#
#create .ssh/config file:
echo "host $hostnick" >> .ssh/config
echo "    hostname $host" >> .ssh/config
echo "    user $suser" >> .ssh/config
echo "    identityfile /home/$luser/.ssh/id_rsa_$hostnick" >> .ssh/config
echo "    compression yes" >> .ssh/config
echo "    protocol 2" >> .ssh/config
chmod -R go-rwx .ssh
scp .ssh/id_rsa_$hostnick.pub $suser@$host:tmp
####### you will be prompted here for your normal password
#
#now log into host and complete operation
ssh $suser@$host
####### you will be prompted here for your normal password
#
mkdir -p .ssh
cat tmp >> .ssh/authorized_keys2
chmod -R go-rwx .ssh
rm -f tmp
exit
#now you can try logging in using:
ssh #hostnick