you@local$ssh-keygen -t rsa -b 4096 -C [your username (e.g. msun]
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
Enter your password twice.
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
Copy the public key to the remote server
you@local$ cat ~/.ssh/id_rsa.pub | ssh msun@<remove server> 'cat - >> ~/.ssh/authorized_keys' you@remote's password:
Store your password to the keychain. This ensures you don't need to type password in other terminal session
ssh-add -K ~/.ssh/id_rsa
Reference:
http://mah.everybody.org/docs/ssh#upload-public-keyhttps://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
No comments:
Post a Comment