#create keygen at local
$ ssh-keygen -t rsa -b 2048
Add ssh key to server copy keygen at ~/.ssh/id_rsa.pub.
create .ssh directory with permission is 755 at folder ~
#quick copy rsa key to ssh on server
ssh-copy-id ‘-p XXXX -i ~/.ssh/id_rsa.pub username@host’
add public key to authorized_keys2
change mode from 644 to 400
if edit , you must change mod file authorized_keys2 to 644,
when finish, make sure permission of .ssh is 700 , authorized_keys2 is 400.