Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:configure_key-based_authentication_for_ssh [2016/02/29 22:15] billdozor created |
linux_wiki:configure_key-based_authentication_for_ssh [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Configure Key-based Authentication For Ssh ====== | + | ====== Configure Key-based Authentication For SSH ====== |
**General Information** | **General Information** | ||
- | About this page/how-to/script. | + | SSH public/private key authentication for password-less logins. |
---- | ---- | ||
- | Start from source system. | + | ===== On Server1 ===== |
- | \\ | + | Generate public/ |
- | Generate public/ | + | |
<code bash> | <code bash> | ||
ssh-keygen | ssh-keygen | ||
Line 19: | Line 18: | ||
\\ | \\ | ||
- | Copy from source | + | Copy from server1 |
- | <code bash> | + | |
- | ssh-copy-id user@10.0.0.5 | + | |
- | </ | + | |
- | + | ||
- | \\ | + | |
- | Add private key passphrase to ssh-agent | + | |
- | + | ||
- | 1) Check to see if ssh-agent is running | + | |
- | <code bash> | + | |
- | eval $(ssh-agent) | + | |
- | Agent pid 6599 | + | |
- | </ | + | |
- | * Example of it running | + | |
- | + | ||
- | 2a) If not running, start it | + | |
- | <code bash> | + | |
- | ssh-agent bash | + | |
- | </ | + | |
- | + | ||
- | 2b) If running, or after starting it, execute the following | + | |
<code bash> | <code bash> | ||
- | ssh-add | + | ssh-copy-id user@192.168.1.151 |
</ | </ | ||
- | * 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 | + | Execute Command on remote system |
<code bash> | <code bash> | ||
- | ssh user@10.0.0.1 "ls -la" | + | ssh user@192.168.1.151 "ls -la" |
</ | </ | ||
---- | ---- | ||