Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid always entering passphrase for id_rsa on terminal startup?

Currently every time I start up terminal I get prompted the following:

Last login: Mon Nov 28 21:32:16 on ttys000

Agent pid 2733

Enter passphrase for /Users/my_name/.ssh/id_rsa:

Could you please guide me on how I can avoid having to enter a passphrase everytime?

like image 361
HosseinK Avatar asked Dec 08 '22 20:12

HosseinK


2 Answers

You could add your passphrase to your keychain:

ssh-add -K ~/.ssh/id_rsa

Or you can add it in your ~/.ssh/config:

Host *
UseKeychain yes
like image 118
Jules Avatar answered Dec 11 '22 09:12

Jules


You probably wrote to your ~/.bashrc lines

`eval ssh-agent`
ssh-add

or something like this. This means that it will start a new ssh-agent for every shell you open, which is certainly not what you want. The agent should start when you open your Xsession (~/.xsession), or you should check if the agent is running before running a new one:

[ -z $SSH_AUTH_SOCK ] && `eval ssh-agent` && ssh-add
like image 29
Jakuje Avatar answered Dec 11 '22 10:12

Jakuje