How do I configure sshd on Debian to use Public Key Authentication?

You will need to edit /etc/ssh/sshd_config as follows:

# Both of these are probably already there, but commented
PubkeyAuthentication yes
# The next line makes sure that sshd will look in 
# $HOME/.ssh/authorized_keys for public keys
AuthorizedKeysFile      %h/.ssh/authorized_keys

Additionally, if you want to disable password authentication alltogether (which is usually a good idea, if you use keypairs), add the following:

# Again, this rule is already there, but usually defaults to 'yes'
PasswordAuthentication no

After that, restart ssh by issueing /etc/init.d/sshd restart and you should be fine!

The above assumes you have already properly created the .ssh dir with the proper permissions.

This means you set chmod 0700 to ~/.ssh.


Here are the steps: 1. Upload your public key to the site and add it to the ~/.ssh/authorized_keys file. 2. Ensure that the authorized keys has attributes of 0600 (chmod 0600 ~/.ssh/authorized_keys) 3. Now try to ssh, if you using putty, run the pageant and load your private key.


Also check owner and permission on your home directory. You must own your home directory and permission should not be more than 755.

These settings are unusual, but it is difficult to understand when it happens.