linux_wiki:ssh_pub_priv_keys

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux_wiki:ssh_pub_priv_keys [2014/12/08 20:40]
billdozor
linux_wiki:ssh_pub_priv_keys [2019/05/25 23:50]
Line 1: Line 1:
-====== SSH Pub/Priv Keys ====== 
  
-Description: Create public/private key pair to login to remote systems with no password prompt. 
- 
-From the local client: 
- 
-===== Create public/private key pair ===== 
-<code bash> 
-ssh-keygen -t rsa 
-Enter file to save the key (Enter for default). 
-Enter password twice to encrypt key pair. 
-</code> 
- 
-Two files are created: 
- 
-  * $HOME/.ssh/id_rsa = private key (do not share) 
-  * $HOME/.ssh/id_rsa.pub = public key (this will go on server) 
- 
-===== Put public key on remote server(s) ===== 
-<code bash> 
-ssh-copy-id -i $HOME/.ssh/id_rsa.pub username@server 
-</code> 
- 
-If ssh-copy-id is not installed, use scp instead: 
-<code bash> 
-scp $HOME/.ssh/id_rsa.pub username@server:~/tmp.pub 
-ssh username@server 
-cat $HOME/tmp.pub >> .ssh/authorized_keys 
-rm tmp.pub 
-</code> 
- 
-===== Ensure ssh-agent is running and add private key passphrase ===== 
-<code bash> 
-eval $(ssh-agent) 
-ssh-add 
-</code> 
-Enter private key passphrase to add private key to the ssh-agent. 
- 
-===== Login to server, no password prompt because of ssh-agent/ssh-add ===== 
-<code bash> 
-ssh username@server 
-</code> 
  • linux_wiki/ssh_pub_priv_keys.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)