4

On my Mac, I created an RSA key with ssh-keygen -t rsa and saved it as .ssh/authorized_keys on the target server (Ubuntu).

I put this in server's /etc/ssh/sshd_config:

PubkeyAuthentication yes
RSAAuthentication yes

and restarted SSH. However, it ignores the key. What's wrong?

Dan
  • 317
  • 1
  • 4
  • 13

3 Answers3

4

OpenSSH tutorial explains how to resolve this problem.

Chances are, your /home/<user> or ~/.ssh/authorized_keys permissions are too open by OpenSSH standards. You can get rid of this problem by issuing the following commands:

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Dan
  • 317
  • 1
  • 4
  • 13
  • Finally the answer I needed. Ssh should at least output a warning explaining the key was being ignored by the server of something like that. – VinGarcia Aug 05 '17 at 00:15
1

Your key should go to .ssh/id_rsa on the Mac, and id_rsa.pub from the Mac should be added to the .ssh/authorized_keys file on the server.

You should probably also chmod -R go-wr ~/.ssh on the server.

lunixbochs
  • 848
  • 5
  • 8
1

You want to connect to your Ubuntu Server without entering a password?

When you generate a new rsa keypair on your mac you end up with a private key (id_rsa) and a public key (id_rsa.pub). You'll find them in ~/.ssh/ by default.

Login into your ubuntu server and paste the content of id_rsa.pub into ~/.ssh/authorized_keys. After this you should be able to connect without a password. On a standard ubuntu system you don't need to touch the sshd_config at all.

dbanck
  • 403
  • 1
  • 3
  • 9
  • Hi, thanks for the reply. Turned out, the problem was due to too loose permissions on the `.ssh` folder. – Dan Feb 15 '12 at 19:55