bashsshterminalssh-keyspassphrase

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?


Solution

  • 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