0

I appreciate this is a recurring question, but I'm really struggling to get my SSH connection password-less irrespective of the many threads and changes I've done so far. I do remember this was once used to work fine.

On my local Mac (Catalina)

  • my keys are in the ~.ssh folder which has permissions set to 700
  • files have 600 permission
  • everything is own by my user

I have also created a config file as

Host MyRemoteHost
HostName 181.12.14.123
User myself
PasswordAuthentication no
PreferredAuthentications=publickey
IdentityFile ~/.ssh/id_rsa

On the remote server, Ubuntu

  • the pub key is in the ~.ssh/authorized_keys
  • permission on the above is 600
  • I've amended the ssh_config file in /etc/ssh by adding a PreferredAuthentications publickey,password as I thought it was the only bit missing, although here the file is owned by the root user.

Just in case I have re-created the local RSA key using a 4096 bytes length.

When SSH in verbose mode, I can ultimately see the private key mode is used, but I was remembering/expecting for a no password prompt at all.

Am I wrong?

  • 3
    PasswordAuthentication no should be in the /etc/ssh/sshd_config file inside the remote Ubuntu server. Not in the local Mac. Same goes for PreferredAuthentications=publickey. – user68186 Feb 9 at 14:08
  • 3
    Note the difference between ssh_config and sshd_config. The second one is for configuring the ssh server. – user68186 Feb 9 at 14:11
  • 3
    Are you being asked for a password, or for a passphrase to unlock the key? – steeldriver Feb 9 at 14:12
  • @steeldriver I'm asked for a passphrase to unlock the key now that I noticed. So I guess this is somehow normal. I was puzzled because I was trying to play with rsync to update a site, but all the time I'm asked for the passphrase – Andrea Moro Feb 9 at 15:00
  • @user68186 PasswordAuthentication is already in the sshd_config file set to no. The PreferredAuthentication though I felt it was necessary in the ssh_config but thinking to this, it doesn't make sense. Should that go with the = to specify the value? I can see all the other settings without it. – Andrea Moro Feb 9 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.