0

I have a frustrating SSH access problem on a new VM with Centos 7 which is driving me crazy!! It seems to be a first-time login problem on the new box. I know all the basic settings ... this is about the 5th VM I have set up with this OS (So ifcfg.eth0, hostname, network etc is all good). I can ping the new box as well ... remotely and from it to other boxes in the network. But ... When I attempt remote SSH access I just keep getting the error:

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

I have seen this before and know about /etc/ssh/ssh_config ... and we are just talking password authentication here (not ssh key login). But only on this box I am getting it. I started off with just:

host *
GSSAPIAuthentication yes   

This is what I used on the other machines and it always worked! So, I have since tried uncommenting these keys:

#PasswordAuthentication yes

and

#PermitRootLogin yes

Above because I am logging in with root. And ... I also tried commenting out GSSAPIAuthentication. And yes ... I always restart the sshd daemon after making changes to this file (systemctl restart sshd.services) Also ... I see nothing significant in /var/log/messages or /var/log/secure .. I've tried verbose using the ssh -v switch and what I do notice on this problem box is that shortly before the above "Permission denied" error is output I get this message:

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic

Whereas on other boxes which work I always get this:

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password

So clearly password authentication is not enabled ! The final straw is this: I get this same error message EVEN WHEN I SSH FROM THIS BOX TO ITSELF! There HAS to be some SSH setting I am missing. Can someone please advise me what this setting is?

  • Hi, and welcome. Did you restart sshd after modifying the configuration file? – Andy Dalton Aug 23 '18 at 14:18
  • 1
    Make sure you are writing those lines (PasswordAuthentication yes and PermitRootLogin yes) in /etc/ssh/sshd_config, and not the ssh_config. I notice you mentioning ssh_config in your question. If you are doing this right, it should work after restarting ssh service. – Vinod Aug 23 '18 at 14:50
  • Please edit your question to include the contents of your sshd_config file (or at least the relevant parts), instead of describing what's in it and what you changed. – Kenster Aug 23 '18 at 14:57
  • What is tbe exact command that you are using to log into the Centos 7 machine? – Nasir Riley Aug 23 '18 at 17:36
  • I am using this: ssh root@centoshost ... at least most of the time. But I have also used the -i switch to indicate path to pubkey. And of course the -v sometimes to get verbose – Paul Cartier Aug 23 '18 at 18:30
0

You commented out the password authentication. Therefore, openSSH is not accepting passwords as an authentication measure. The same applies to root login.

Remove the # on the lines

PasswordAuthentication yes
PermitRootLogin yes

Then restart the service.

  • I did uncomment them. See above: "I have since tried uncommenting these keys:" And .. I did restart sshd ... also above "And yes ... I always restart the sshd daemon after making changes to this file" In fact I've started sshd, networking and the entire VM many many times :-) – Paul Cartier Aug 23 '18 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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