How to add ssh key to ssh-agent without typing passphrase

While it's entirely not secure you can do the following:

1. Install expect package.

2. Create file ~/.ssh/pass.sh with content:

#!/usr/bin/expect -f

spawn ssh-add /home/user/.ssh/id_rsa

expect "Enter passphrase for /home/user/.ssh/id_rsa:"

send "passphrase\n";

expect "Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa)"

interact

3. chmod 700 ~/.ssh/pass.sh

4. and in ~/.bash_profile add:

eval `ssh-agent`

~/.ssh/pass.sh


Комментарии

Популярные сообщения