Repeated prompts for SSH private key password in single session

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a private SSH key on a shared development server, which is secured with a password.



Even after loading it into ssh-agent, I get re-prompted for the private key password



For some reason, even after I ssh-add the private key, and correctly respond to the password prompt, I am subsequently prompted for the same private key password again, when I git pull in a git clone which uses the same identity file on the same hostname.



I load my SSH settings after login, this way:



➜ ~ cat ~/init_ssh 
#!/usr/bin/env bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa


I run the script and correctly answer the password prompt:



➜ ~ ~/init_ssh
Agent pid 11612
Enter passphrase for /home/username/.ssh/id_rsa:
Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)


I then run git pull or git push in a specific repository clone, and every single time I have to re-enter my SSH password:



➜ repository_clone git:(master) git pull
Enter passphrase for key '/home/username/.ssh/id_rsa':
Already up-to-date.
➜ repository_clone git:(master) git pull
Enter passphrase for key '/home/username/.ssh/id_rsa':
Already up-to-date.


The hostname has an IdentityFile configured in ~/.ssh/config



It so happens that I have the IdentityFile for github.com explicitly set to ~/.ssh/id_rsa, in my ~/.ssh/config:



➜ repository_clone git:(master) cat ~/.ssh/config
Host github.com
IdentityFile ~/.ssh/id_rsa


If I remove the above SSH config entry, I still have the same problem with perpetual password re-prompt.



File permissions are correct



I have confirmed, meanwhile, that all of the permissions on ~ and ~/.ssh directories and the ~/.ssh/id_rsa file are what they should be, according to this guide:



➜ ~ ls -la ~ ~/.ssh ~/.ssh/id_rsa
-rw------- 1 username username 3326 Sep 21 16:53 /home/username/.ssh/id_rsa

/home/username:
total 220
drwxr-xr-x 13 username username 4096 Sep 27 17:11 .
drwxr-xr-x 24 root root 4096 Sep 21 16:09 ..
# [...]

/home/username/.ssh:
total 36
drwxr-xr-x 2 username username 4096 Sep 27 17:07 .
drwxr-xr-x 13 username username 4096 Sep 27 17:11 ..
-rw-r--r-- 1 username username 745 Sep 21 16:43 authorized_keys
-rw------- 1 username username 455 Sep 27 17:07 config
-rw------- 1 username username 3326 Sep 21 16:53 id_rsa
-rw-r--r-- 1 username username 744 Sep 21 16:53 id_rsa.pub
-rw-r--r-- 1 username username 3794 Sep 26 16:28 known_hosts


I'm totally stumped! Can anyone point me in the right direction? Thanks!










share|improve this question

























    up vote
    0
    down vote

    favorite












    I have a private SSH key on a shared development server, which is secured with a password.



    Even after loading it into ssh-agent, I get re-prompted for the private key password



    For some reason, even after I ssh-add the private key, and correctly respond to the password prompt, I am subsequently prompted for the same private key password again, when I git pull in a git clone which uses the same identity file on the same hostname.



    I load my SSH settings after login, this way:



    ➜ ~ cat ~/init_ssh 
    #!/usr/bin/env bash
    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_rsa


    I run the script and correctly answer the password prompt:



    ➜ ~ ~/init_ssh
    Agent pid 11612
    Enter passphrase for /home/username/.ssh/id_rsa:
    Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)


    I then run git pull or git push in a specific repository clone, and every single time I have to re-enter my SSH password:



    ➜ repository_clone git:(master) git pull
    Enter passphrase for key '/home/username/.ssh/id_rsa':
    Already up-to-date.
    ➜ repository_clone git:(master) git pull
    Enter passphrase for key '/home/username/.ssh/id_rsa':
    Already up-to-date.


    The hostname has an IdentityFile configured in ~/.ssh/config



    It so happens that I have the IdentityFile for github.com explicitly set to ~/.ssh/id_rsa, in my ~/.ssh/config:



    ➜ repository_clone git:(master) cat ~/.ssh/config
    Host github.com
    IdentityFile ~/.ssh/id_rsa


    If I remove the above SSH config entry, I still have the same problem with perpetual password re-prompt.



    File permissions are correct



    I have confirmed, meanwhile, that all of the permissions on ~ and ~/.ssh directories and the ~/.ssh/id_rsa file are what they should be, according to this guide:



    ➜ ~ ls -la ~ ~/.ssh ~/.ssh/id_rsa
    -rw------- 1 username username 3326 Sep 21 16:53 /home/username/.ssh/id_rsa

    /home/username:
    total 220
    drwxr-xr-x 13 username username 4096 Sep 27 17:11 .
    drwxr-xr-x 24 root root 4096 Sep 21 16:09 ..
    # [...]

    /home/username/.ssh:
    total 36
    drwxr-xr-x 2 username username 4096 Sep 27 17:07 .
    drwxr-xr-x 13 username username 4096 Sep 27 17:11 ..
    -rw-r--r-- 1 username username 745 Sep 21 16:43 authorized_keys
    -rw------- 1 username username 455 Sep 27 17:07 config
    -rw------- 1 username username 3326 Sep 21 16:53 id_rsa
    -rw-r--r-- 1 username username 744 Sep 21 16:53 id_rsa.pub
    -rw-r--r-- 1 username username 3794 Sep 26 16:28 known_hosts


    I'm totally stumped! Can anyone point me in the right direction? Thanks!










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a private SSH key on a shared development server, which is secured with a password.



      Even after loading it into ssh-agent, I get re-prompted for the private key password



      For some reason, even after I ssh-add the private key, and correctly respond to the password prompt, I am subsequently prompted for the same private key password again, when I git pull in a git clone which uses the same identity file on the same hostname.



      I load my SSH settings after login, this way:



      ➜ ~ cat ~/init_ssh 
      #!/usr/bin/env bash
      eval "$(ssh-agent -s)"
      ssh-add ~/.ssh/id_rsa


      I run the script and correctly answer the password prompt:



      ➜ ~ ~/init_ssh
      Agent pid 11612
      Enter passphrase for /home/username/.ssh/id_rsa:
      Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)


      I then run git pull or git push in a specific repository clone, and every single time I have to re-enter my SSH password:



      ➜ repository_clone git:(master) git pull
      Enter passphrase for key '/home/username/.ssh/id_rsa':
      Already up-to-date.
      ➜ repository_clone git:(master) git pull
      Enter passphrase for key '/home/username/.ssh/id_rsa':
      Already up-to-date.


      The hostname has an IdentityFile configured in ~/.ssh/config



      It so happens that I have the IdentityFile for github.com explicitly set to ~/.ssh/id_rsa, in my ~/.ssh/config:



      ➜ repository_clone git:(master) cat ~/.ssh/config
      Host github.com
      IdentityFile ~/.ssh/id_rsa


      If I remove the above SSH config entry, I still have the same problem with perpetual password re-prompt.



      File permissions are correct



      I have confirmed, meanwhile, that all of the permissions on ~ and ~/.ssh directories and the ~/.ssh/id_rsa file are what they should be, according to this guide:



      ➜ ~ ls -la ~ ~/.ssh ~/.ssh/id_rsa
      -rw------- 1 username username 3326 Sep 21 16:53 /home/username/.ssh/id_rsa

      /home/username:
      total 220
      drwxr-xr-x 13 username username 4096 Sep 27 17:11 .
      drwxr-xr-x 24 root root 4096 Sep 21 16:09 ..
      # [...]

      /home/username/.ssh:
      total 36
      drwxr-xr-x 2 username username 4096 Sep 27 17:07 .
      drwxr-xr-x 13 username username 4096 Sep 27 17:11 ..
      -rw-r--r-- 1 username username 745 Sep 21 16:43 authorized_keys
      -rw------- 1 username username 455 Sep 27 17:07 config
      -rw------- 1 username username 3326 Sep 21 16:53 id_rsa
      -rw-r--r-- 1 username username 744 Sep 21 16:53 id_rsa.pub
      -rw-r--r-- 1 username username 3794 Sep 26 16:28 known_hosts


      I'm totally stumped! Can anyone point me in the right direction? Thanks!










      share|improve this question













      I have a private SSH key on a shared development server, which is secured with a password.



      Even after loading it into ssh-agent, I get re-prompted for the private key password



      For some reason, even after I ssh-add the private key, and correctly respond to the password prompt, I am subsequently prompted for the same private key password again, when I git pull in a git clone which uses the same identity file on the same hostname.



      I load my SSH settings after login, this way:



      ➜ ~ cat ~/init_ssh 
      #!/usr/bin/env bash
      eval "$(ssh-agent -s)"
      ssh-add ~/.ssh/id_rsa


      I run the script and correctly answer the password prompt:



      ➜ ~ ~/init_ssh
      Agent pid 11612
      Enter passphrase for /home/username/.ssh/id_rsa:
      Identity added: /home/username/.ssh/id_rsa (/home/username/.ssh/id_rsa)


      I then run git pull or git push in a specific repository clone, and every single time I have to re-enter my SSH password:



      ➜ repository_clone git:(master) git pull
      Enter passphrase for key '/home/username/.ssh/id_rsa':
      Already up-to-date.
      ➜ repository_clone git:(master) git pull
      Enter passphrase for key '/home/username/.ssh/id_rsa':
      Already up-to-date.


      The hostname has an IdentityFile configured in ~/.ssh/config



      It so happens that I have the IdentityFile for github.com explicitly set to ~/.ssh/id_rsa, in my ~/.ssh/config:



      ➜ repository_clone git:(master) cat ~/.ssh/config
      Host github.com
      IdentityFile ~/.ssh/id_rsa


      If I remove the above SSH config entry, I still have the same problem with perpetual password re-prompt.



      File permissions are correct



      I have confirmed, meanwhile, that all of the permissions on ~ and ~/.ssh directories and the ~/.ssh/id_rsa file are what they should be, according to this guide:



      ➜ ~ ls -la ~ ~/.ssh ~/.ssh/id_rsa
      -rw------- 1 username username 3326 Sep 21 16:53 /home/username/.ssh/id_rsa

      /home/username:
      total 220
      drwxr-xr-x 13 username username 4096 Sep 27 17:11 .
      drwxr-xr-x 24 root root 4096 Sep 21 16:09 ..
      # [...]

      /home/username/.ssh:
      total 36
      drwxr-xr-x 2 username username 4096 Sep 27 17:07 .
      drwxr-xr-x 13 username username 4096 Sep 27 17:11 ..
      -rw-r--r-- 1 username username 745 Sep 21 16:43 authorized_keys
      -rw------- 1 username username 455 Sep 27 17:07 config
      -rw------- 1 username username 3326 Sep 21 16:53 id_rsa
      -rw-r--r-- 1 username username 744 Sep 21 16:53 id_rsa.pub
      -rw-r--r-- 1 username username 3794 Sep 26 16:28 known_hosts


      I'm totally stumped! Can anyone point me in the right direction? Thanks!







      bash shell ssh ssh-agent ssh-config






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 27 at 17:16









      Daniel B.

      1033




      1033




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          The agent you start is only available to the ~/init_ssh script, which immediately exits after it loads the key.



          Use source ~/init_ssh or place eval "$(ssh-agent -s)" in your .profile or equivalent file.



          After you load the agent, you should have $SSH_AUTH_SOCK point so a socket.






          share|improve this answer






















          • That did the trick, thanks much!
            – Daniel B.
            Sep 27 at 19:49










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471893%2frepeated-prompts-for-ssh-private-key-password-in-single-session%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          The agent you start is only available to the ~/init_ssh script, which immediately exits after it loads the key.



          Use source ~/init_ssh or place eval "$(ssh-agent -s)" in your .profile or equivalent file.



          After you load the agent, you should have $SSH_AUTH_SOCK point so a socket.






          share|improve this answer






















          • That did the trick, thanks much!
            – Daniel B.
            Sep 27 at 19:49














          up vote
          1
          down vote



          accepted










          The agent you start is only available to the ~/init_ssh script, which immediately exits after it loads the key.



          Use source ~/init_ssh or place eval "$(ssh-agent -s)" in your .profile or equivalent file.



          After you load the agent, you should have $SSH_AUTH_SOCK point so a socket.






          share|improve this answer






















          • That did the trick, thanks much!
            – Daniel B.
            Sep 27 at 19:49












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          The agent you start is only available to the ~/init_ssh script, which immediately exits after it loads the key.



          Use source ~/init_ssh or place eval "$(ssh-agent -s)" in your .profile or equivalent file.



          After you load the agent, you should have $SSH_AUTH_SOCK point so a socket.






          share|improve this answer














          The agent you start is only available to the ~/init_ssh script, which immediately exits after it loads the key.



          Use source ~/init_ssh or place eval "$(ssh-agent -s)" in your .profile or equivalent file.



          After you load the agent, you should have $SSH_AUTH_SOCK point so a socket.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 27 at 21:37

























          answered Sep 27 at 17:34









          RalfFriedl

          4,2481725




          4,2481725











          • That did the trick, thanks much!
            – Daniel B.
            Sep 27 at 19:49
















          • That did the trick, thanks much!
            – Daniel B.
            Sep 27 at 19:49















          That did the trick, thanks much!
          – Daniel B.
          Sep 27 at 19:49




          That did the trick, thanks much!
          – Daniel B.
          Sep 27 at 19:49

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471893%2frepeated-prompts-for-ssh-private-key-password-in-single-session%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Christian Cage

          How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?