On Tuesday 08 July 2014 14:07:35 Sudhir Khanger wrote:
Hello,
I am wondering how you guys manage multiple ssh keys on your system.
This is how I got to manage multiple keys on my system.
Generate keys
ssh-keygen -t rsa -f ~/.ssh/test_ssh_key_1 -C "yours(a)yours.com"
ssh-keygen -t rsa -f ~/.ssh/test_ssh_key_2 -C "yours(a)yours.com"
ssh-keygen -t rsa -f ~/.ssh/test_ssh_key_3 -C "yours(a)yours.com"
ksshaskpass came already installed and SSH_ASKPASS set to
/usr/bin/ksshaskpass.
Moving on these keys can be added to ssh-agent using following command.
ssh-add ~/.ssh/test_ssh_key_1
I ran these commands through KRunner so it triggers ksshaskpass and
not password prompt on the terminal. This way Kwallet will save the
password and I will not be asked to enter passphrase every time I am
accessing anything over ssh.
In order to automatically load these keys at system start I created
following script.
~/.kde/Autostart/ksshaskpass
#!/bin/sh
export SSH_ASKPASS=/usr/bin/ksshaskpass
ssh-add ~/.ssh/test_ssh_key_1 < /dev/null
ssh-add ~/.ssh/test_ssh_key_2 < /dev/null
ssh-add ~/.ssh/test_ssh_key_3 < /dev/null
chmod 755 ~/.kde/Autostart/ksshaskpass
The problem is if KWallet is not opened as soon as system is started
KDE will start the script triggering ksshaskpass to ask to enter
password for the first ssh key. This is a working setup but not
perfect.
I was wondering if there is a way to ssh-add the key to ssh-agent
on-demand or maybe trigger to open KWallet instead of ksshaskpass.
What is wrong with my setup? How do you manage your ssh keys?
Thats exactly how I do it too, love to know of other ways
Martin