SSH key authentication
Generate ssh key
1 |
$> ssh-keygen |
Start ssh agent
1 |
$> ssh-agent /bin/bash |
Add ssh key
1 |
$> ssh-add ~/.ssh/id_rsa |
List all used ssh keys
1 |
$> ssh-add -l |
Show public key
1 |
$> cat ~/.ssh/id_rsa.pub |
Copy key to remote host via ssh
1 |
$> ssh-copy-id -i id_rsa.pub ssh-user@host.domain |
If ssh-copy-id isn’t available on the respektive system, you can use the following snipped:
1 2 3 4 |
$> cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh/ && chmod 600 ~/.ssh/authorized_keys' |
Add permanent usage of key (SSH Client Configuration) You can […]