Repeated prompts for SSH private key password in single session
Clash 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!
bash shell ssh ssh-agent ssh-config
add a comment |Â
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!
bash shell ssh ssh-agent ssh-config
add a comment |Â
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!
bash shell ssh ssh-agent ssh-config
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
bash shell ssh ssh-agent ssh-config
asked Sep 27 at 17:16
Daniel B.
1033
1033
add a comment |Â
add a comment |Â
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.
That did the trick, thanks much!
â Daniel B.
Sep 27 at 19:49
add a comment |Â
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.
That did the trick, thanks much!
â Daniel B.
Sep 27 at 19:49
add a comment |Â
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.
That did the trick, thanks much!
â Daniel B.
Sep 27 at 19:49
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password