This is an old revision of the document!
Configure Key-based Authentication For Ssh
General Information
About this page/how-to/script.
Start from source system.
Generate public/private key pair
ssh-keygen
- By default, uses type “rsa”
- Private key in /home/<user>/.ssh/id_rsa
- Public key in /home/<user>/.ssh/id_rsa.pub
Copy from source to destination server
ssh-copy-id user@10.0.0.5
Add private key passphrase to ssh-agent
1) Check to see if ssh-agent is running
eval $(ssh-agent) Agent pid 6599
- Example of it running
2a) If not running, start it
ssh-agent bash
2b) If running, or after starting it, execute the following
ssh-add
- This allows for remote connecting without entering in any private key passphrase (if entered when key was generated)
- This step can be skipped if no pass-phrase was entered while generating the key.
Execute Command on remote system
ssh user@10.0.0.1 "ls -la"