Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer
    
Yeah, the latter was the case. More details in my answer. –  Dan Feb 15 '12 at 19:54
1  
The command should be: chmod -R go-wr ~/.ssh –  Flash Sheridan Mar 27 '13 at 20:40

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
share|improve this answer

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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