ssh 免輸入 password 登入的方式 , ssh-keygen , rsa better

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)
ssh-keygen
可以再用 password 增加保護, 但也可略過 password , 之後會產生兩個檔 , id_rsa . id_rsa.pub (公鑰)

把公鑰 貼到目標 server 的 ~/.ssh/authorized_keys 即可

2020.0926
ssh-copy-id USER@SERVER