Search code examples
sshcentosvirtual-machineopensshaccess-denied

Centos SSH access denied


I'm pulling my hair out over this and can't find a solution anywhere.

After a reboot I started getting "Connection refused" through port 22000 which was the one I had configured and SSH was still listening to(I double checked). I'm connecting from a PC on the same LAN.

I could connect to port 22 suddenly after that but there I got "Access denied" after entering my password. After troubleshooting this I got tired and reinstalled openssh, with that I got a clean config and everything including the firewall and selinux is now configured to use port 22 with these commands:

sudo semanage port -a -t ssh_port_t -p tcp 22
sudo firewall-cmd --permanent --zone=public --add-port=22/tcp
sudo firewall-cmd --reload

Still access denied even though it's the correct password, I know since I can use the exact same directly on the server.

I have tried:

  • Putting "PermitRootLogin yes" in the sshd_config and login with root but that is also denied, same with a new test account I made. I removed "AllowUsers [username]" from the config before this.

  • Restarted the SSH service and rebooted as well several times.

  • The solution here to no avail: Centos 7 Remote SSH access denied

  • Setting selinux to "Permissive"

  • Disabling the firewall
  • Changing password to one without special characters
  • Triple checking that the SSH service is running

Neither "/var/log/secure" nor "/var/log/messages" log anything regarding my attempts to login.

I must have missed something, anyone have any ideas what?


Solution

  • I solved it and I really don't want to post the answer since it was embarrassingly easy, but I refuse to leave the question unsolved for the poor souls with similar problems.

    I rebooted my PC.... facedesk