There are two ways to add id_rsa.pub on the local side to authorized_keys on the server side:
1. Direct operation of files
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
2. By command
ssh-copy-id -i id_rsa.pub user@hostname
ssh-copy-id will detect whether the id_rsa private key file exists, you can touch id_rsa.
http://www.jianshu.com/p/848e982df6be