Fix The Error “permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)”

SSH also known as Secure shell, is a protocol for network communication that allows two systems (computers) to communicate. It is a way to remote login securely from one system to another. When you are working on SSH, you may experience the error “permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)”.

Don’t worry when you end up with this error as we are here to provide you a helping hand to drag you out of it. Go ahead with the post to get information to eliminate the error.

How the error occurs

When you are trying to work on a project using SSH, you get the error warning. This is exactly what you received on your end

permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

What causes the error?

You get into this permission denied error because the authentication failed to make a connection. Probably, error signifies the public key problem, which often misleads. The sshd_config is probably causing the error, which is the file having SSH server configuration. Another reason you are receiving the error may be insufficient permission to the file authorized_keys. It is comprised of the list of public keys for all clients permitted to SSH into the server. So, all in all, the inability of the system to read from the specified file causes the permission denied error.

How To Solve the error “permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)”

We compile the best possible ways to fix the error simply and effectively. Check out them

Option 1 – Enable password authentication

The first option to try to fix the error warning is to enable password authentication. In case you like to access the SSH server using a password, enabling password authentication works. To do that, you need to text editor to open the file. The following utilizes the nano editor:

sudo nano /etc/ssh/sshd_config

Here, you need to look for the PasswordAuthentication line and ensure it has ‘yes’ in the end. Next, you need to look for an option ChallengeResponseAuthentication and add ‘no’ to disable it. once done, save and exit.

Use the following command to restart the SSH service

sudo systemctl restart sshd

This option can fix the error successfully.

Option 2 – Change the permission of the File system

Another option that can fix the error is to change the permission of the File system. The method of SSH authentication using password login is sometimes not recommended regarding security concerns. Hence, the suggested way to solve the authentication method of the public key. Use the following to do that:

On the text editor, open the file sshd_config

sudo nano /etc/ssh/sshd_config

You need to ensure you have the following settings in the file:

PermitRootLogin no
PubkeyAuthentication yes

This is also a powerful way to tackle the error warning.


In this post, we discussed effective options to help you get rid of the error message “permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)”. You can try any of the options.

I hope you find it helpful!

Don’t hesitate to write back to us in the comment box you see below. Your feedback is appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *