Once an SSH key has been created, the ssh-copy-id command can be used to install it as an authorized key on the server. Once the key has been authorized for SSH, it grants access to the server without a password.
ssh-copy-id -i ~/.ssh/mykey user@host
Test the new key —>
ssh -i ~/.ssh/mykey user@host
#產生 ssh key pair (普遍使用 RSA)
可以再用 password 增加保護, 但也可略過 password , 之後會產生兩個檔 , id_rsa . id_rsa.pub (公鑰)
把公鑰 貼到目標 server 的 ~/.ssh/authorized_keys 即可