- Generate a new SSH key pair
ssh-keygen
- When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
- At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases. For default press Enter.
- Copy the public key to your remote server
ssh-copy-id username@remote_host
- If face Error try this..
ssh-copy-id -i ~/.ssh/id_rsa.pub USERNAME@IP_ADDRESS
- Test the connection
ssh username@remote_host