[SSH] Things to Be Careful About When Setting Up Public Keys and How to Handle 'Permission denied (publickey,gssapi-with-mic).'

Tadashi Shigeoka ·  Mon, February 27, 2012

After setting up SSH public keys on a server, when trying to connect with key authentication, the following error often occurs:

Permission denied (publickey,gssapi-with-mic).

What to Do When Setting Up SSH Public Keys

・Change the permission of the .ssh directory on the remote side to 700

・Change the permission of the public key file (authorized_keys) to 600

# chmod 700 .ssh/
# chmod 600 .ssh/authorized_keys

・Change the access permissions of the .ssh directory on the remote side to the user who will connect via SSH

・Change the access permissions of the public key file to the user who will connect via SSH

(Example) Change permissions to User: codenote, Group: programmer

# chown codenote:programmer .ssh/
# chown codenote:programmer .ssh/authorized_keys

That’s all.

【Reference】

When “Permission denied (publickey,gssapi-with-mic).” appears in ssh - A Tomorrow Different from Today

That’s all from the Gemba.