0

For a long time, I was baffled by why ssh command was asking for a password sometimes, and sometimes not. Even when I was using the same private/public key pair on many different clusters, I was sometimes getting asked for a password, and sometimes I was not.

Today I tried accessing a cluster that normally requires a password when I try to ssh into it. Normally, to access the cluster I do ssh <ip address>. Today, I did ssh <username>@<ip address> to get in, and it did not ask me for a password!

And, it hasn't asked me for a password since then. This is strange...why does just providing the username cause it to not prompt me for a password anymore? or is there something else that I'm missing that might have changed this?

I checked the permissions on the ~/.ssh directory and everything looks correct there....what other things to check?

closed as unclear what you're asking by Gilles, Stephen Rauch, Kusalananda, GAD3R, Rui F Ribeiro Aug 27 '17 at 15:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Could you share your .ssh/config or relevant portions thereof? If you're using ControlMaster and ControlPersist, then the first connection will establish a control socket that later connections may use without authenticating (see the ssh_config manual). – Kusalananda Aug 26 '17 at 6:30
  • sure, @Kusalananda one second. I can tell you for sure that I do not have ControlMaster and I do not have ControlPersist. So, whatever the default values are for those are what I'm using. I DO however have ForwardingAgent Yes, which might be making a difference here, as was pointed about by some people previously. – guimption Aug 26 '17 at 23:28
  • Please don't use comments to clarify your question and/or respond to requests for more information; instead,  edit your question to make it clearer and more complete. – Scott Aug 27 '17 at 6:12
1

I suspect you have a password on the ssh private key, and that ssh-agent are running somewhere.

When the first connection is made, and there is nothing in the ssh-agent, then it'll ask you the decryption password for the private key. Once it is entered, it'll add it to the ssh-agent, and that'll then (on subsequent connections until it gets cleared) use the key from the ssh-agent.

  • I do not have enough points to vote right now, but thank you. – guimption Aug 26 '17 at 23:29
  • So @Hvisage you suspect that the client's ssh agent probably did not have this private key attached, and therefore when I first was prompted for the password, it somehow permanently associated my private key with that password, and thus I did not have to enter a password ever since. Is that what you're saying? I could understand that being true if I was only asked for a password once, but that is not the case - I was asked for a password every time I ssh'd for the past week. It was only yesterday that I stopped needing a password. Do you have any clue why that might be happening? Thanks. – guimption Aug 27 '17 at 0:06
  • My only other hypothesis is if the ssh-agent was somehow not running, unbeknownst to me, and at some point it got started yesterday. and, after it got started, every time after that I did not need my ssh password. Do you agree with that? – guimption Aug 27 '17 at 0:06
  • one way to test your hypothesis, would be to disable the ssh-agent on the client side, and then ssh into the server. Then, I could see if it keeps prompting me for a password again and again. Then I could enable the ssh-agent, add the private key to it via ssh-add ~/.ssh/id_rsa and see if it only prompts me for the password once, and then does NOT prompt me any time after that? – guimption Aug 27 '17 at 0:11
  • Sounds about right :) – Hvisage Sep 7 '17 at 22:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.