SSH / Putty can't connect

Issues related to configuring your network
Post Reply
DangerDane
Posts: 14
Joined: 2014/12/05 09:52:36

SSH / Putty can't connect

Post by DangerDane » 2014/12/05 13:24:00

I just installed CentOS on a production server today at work and I can ping it without any problems, atm it doesn't have internet access but that is something that will be remedied in time (not a server issue). I have enabled remote access on the server and it looks like its listening at port 22 like its supposed to. But when I try to use putty from my end and towards the server I get the message that the connection is refused?.

Is it a firewall issue or something else I need to look at?, because I need to get it working because another tech is going to SSH into the box and install an SMS gateway and a few other things.

If you have any questions please ask and I will try to answer them.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SSH / Putty can't connect

Post by TrevorH » 2014/12/05 14:26:40

Run iptables-save and see if port 22 is allowed.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

DangerDane
Posts: 14
Joined: 2014/12/05 09:52:36

Re: SSH / Putty can't connect

Post by DangerDane » 2014/12/05 15:10:48

iptables v1.4.21: No command specified is what I get when I try to run that command. Or am I supposed to run it as root?

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: SSH / Putty can't connect

Post by AlanBartlett » 2014/12/05 15:19:13

DangerDane wrote:iptables v1.4.21: No command specified is what I get when I try to run that command. Or am I supposed to run it as root?
Yes, execute that command as root.
Image 100% Linux and, previously, Unix. Co-founder of the ELRepo Project.

DangerDane
Posts: 14
Joined: 2014/12/05 09:52:36

Re: SSH / Putty can't connect

Post by DangerDane » 2014/12/05 15:39:06

Code: Select all

-A IN_Public_allow -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
Does that look right?.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SSH / Putty can't connect

Post by TrevorH » 2014/12/05 16:05:00

Yes, that looks correct for a CentOS 7 machine with firewalld enabled and running. It suggests to me that you might have a hardware firewall in front of the box that prevents you accessing it or that you have the wrong IP address or that sshd is not running on the machine in question (or not listening on port 22).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

DangerDane
Posts: 14
Joined: 2014/12/05 09:52:36

Re: SSH / Putty can't connect

Post by DangerDane » 2014/12/05 16:17:03

According to netstat it is listening for SSH, but I might suspect there is s hardware firewall in place, but just found it odd that pings propagate correctly back and forth. And I just checked and the OpenSSH server is running and has been running since the server went up.

fulminemizzega
Posts: 1
Joined: 2015/01/16 01:34:05

Re: SSH / Putty can't connect

Post by fulminemizzega » 2015/01/16 01:51:42

Hi all, I'm experiencing the same thing. I've got two fresh CentOS 7 installs, one physical another inside a VM, used minimal iso, then updated everything using yum. I can only work with the VM right now. After boot the vm can't be accessed via ssh (ping is ok), restarting firewalld solves everything.
I noticed this behaviour is not consistent, rebooting the VM sometimes fixes the issue, then after another reboot ssh may or may not work.
I can't reach the physical machine, but I ran nmap -Pn -p 22 against it and it reports

Code: Select all

Host is up.
PORT   STATE    SERVICE
22/tcp filtered ssh
(same thing does the VM when I can't ssh)

Does anyone know what's happening?

Post Reply