[Client] Key generate

create pub, private key at ~/.ssh

cd ~/.ssh
ssh-keygen -t rsa
# created under files
    id_rsa
    id_rsa.pub

upload public key to server.

scp id_rsa.pub [server ip address]:~/

[Client] .ssh/config

vim ~/.ssh/config

Host [server name]
    HostName [server name or ipaddress]
    Port 22
    User [login user name]
    IdentityFile ~/.ssh/id_rsa

[server] regist pub key

login the server.
cd ~
cat rsa.pub >> ~/.ssh/authorized_keys

[server] sshd settings

sudo vim /etc/ssh/sshd_config check the settings

PermitRootLogin no
PasswordAuthentication no
RSAAuthentication yes