When using Public Key authentication or trying to use SSH with your WWPass PassKey you may find yourself getting an error message Putty Fatal Error stating “Server refused our key” and “Disconnected: No supported authentication methods available (server sent: publickey)” after entering your username.  This is due to SSH not having read access to the “authorized_keys” file and, more often than not, it’s due to the user’s home directory being encrypted.  This error will display when the remote user is not logged in on the server (thus the SSH daemon/service can’t see the user’s home folder contents).

putty-refusal-message

 

The fix for this is pretty simple.  The steps are: Move the “authorized_keys” file to an always readable area, set proper user permissions and update the sshd_config file.

  1. Say the current “authorized_keys” file is in /home/joscor/.ssh/authorized_keys .  Since /home/joscor/ isn’t always readable, let’s move the keys file to something like /etc/ssh/keys/joscor/authorized_keys .  This can be done by executing (as root):

    # mkdir -p /etc/ssh/keys/joscor/
    # mv /home/joscor/.ssh/authorized_keys /etc/ssh/keys/joscor/

  2. Now that the files are in the right place, we need to set the proper user permissions for the folder and keys file.

    # chown -R joscor:joscor /etc/ssh/keys/joscor/
    # chmod 600 /etc/ssh/keys/joscor/

  3. Last, but definitely not least, we need to update the /etc/ssh/sshd_config file’s AuthorizedKeysFile variable to reflect our changes.

    # vi /etc/ssh/sshd_config
    AuthorizedKeysFile %h/.ssh/authorized_keys -> AuthorizedKeysFile /etc/ssh/keys/%u/authorized_keys

  4. All of the settings have been changed, now restart the SSH daemon and login using your SSH client!

    # service ssh restart

 

Pin It on Pinterest

Share This