classnotes:rh124:ssh
Configure and Secure SSH
Configure SSH Key-based Authentication
Generating
THis allows you to connect to a server without needing to provide a password
Basic command to create a ssh key is
ssh-keygen
a more compley example is
ssh-keygen -f .ssh/key-with-pass
the -f option allows you to save it with a different name rather than the default id
Sharing the ssh Key
THe command to share is
ssh-copy-id -i .ssh/key-with-pass.pub user@remotehost
If you create a key with a non default name you have to connect to server using
ssh -i .ssh/key-with-pass user@remotehost
SSH Client Configuration
You can create a client based config file for ssh so that you can use differnt keys with different server. THe file is called ~/.ssh/config
Here is a sample of one:
[user@host ~]$ cat ~/.ssh/config host servera HostName servera.example.com User usera IdentityFile ~/.ssh/id_rsa_servera host serverb HostName serverb.example.com User userb IdentityFile ~/.ssh/id_rsa_serverb
classnotes/rh124/ssh.txt · Last modified: by 127.0.0.1