Popular
Latest Articles
- How to Secure your Cisco Router
- Creating CLI Views on a Cisco Router
- Configuring TACACS+ on a Cisco Router
- How to enable SDM on your router
- Build a Samba Server on Redhat / CentOS
- How to set the Time / Date and Timezone in CentOS
- How to install SSH on Solaris 10 x86
- ESX4 - How do I turn on/off a Virtual Machine from the command line ?
Using SSH Keys - Video Tutorial
Saturday, 12 September 2009 15:02
Using ssh keys instead of password authentication allows you to speed up and automate your SSH logins. Ideal for for scripts that require you copy files etc. Below shows you the steps on how to set up SSH Keys. The commands that were run within the video tutorial are :Server
[root@server ~]# ls -lha ~/.ssh
[root@server ~]# ssh root@127.0.0.1
Client
[root@client ~]# ssh-keygen -t rsa
[root@client ~]# scp /root/.ssh/id_rsa.pub
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
:/root/.ssh/authorized_keys
[root@client ~]# ssh
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Debugging
There are a number of reasons why your SSH-Keys may fail to connect you.
To debug sshd and ssh so that you can find the root cause run the following commands. We run the run the ssh daemon to listen on port 1234 so that we don't have to stop the existing sshd process.
Server
[root@server ~]# /usr/sbin/sshd -d -p 1234
Client
[root@client ~]# ssh -vvv -p 1234 root@[server ip address]
A common cause of issues is permission issues. Ensure that '/admin/.ssh/authorized_keys' is set with permissions 600.
Also if you are connecting as another user you will need to edit '/etc/ssh/sshd_config' and add your user to the line that starts with 'AllowUsers'
Additional Resources :