Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to make the jump to VPS from shared hosting for better performances and greater flexibility, but am stuck with the fact that I can't access the machine via ssh.

First of all, the machine is a CentOS 6.3 cPanel x64 with WHM 11.38.0. Sshd is running (it appears in the current running processes).

Making a port scan I see that port 22 is not responding. Port 21 is, but I am not able to access the machine via ftp (I think it's a security measure, but I don't know where to disable/enable it).

So, I'm stuck in WHM and have no way to access the configuration of the machine, neither via ssh nor with ftp/sftp.

When trying to connect with ssh via Terminal I only get this:

ssh: connect to host xx.xx.xxx.xxx port 22: Operation timed out

I also tried to access with the hostname instead of the IP address and it's the same.

There seem to be no firewall in WHM and I have whitelisted my home IP address to access ssh, though there were no restrictions in the first place.

I have been wandering through all the settings and options in WHM for several hours now, but can't seem to find anything.

Does anybody have a clue as to where I should start investigating?

Update: Thanks everyone. It was in fact a matter of firewall. There was a firewall not controlled by the WHM software. I managed to crack into the console from the vps control panel (a terrible, terrible java app that barely took my keyboard input) and disabled the firewall altogether running service iptables stop so that I was able to access the console via ssh with the terminal.

Now I will have to set up the firewall again because the command I ran looks like having completely wiped the iptables. Can you recommend any newby-friendly resource where I can learn how to go about this and what should I block? Or should I just go with something like this: http://configserver.com/cp/csf.html ?

Thanks again to everyone who helped me out.

share|improve this question

closed as not a real question by Skyhawk, Wesley, mdpc, Falcon Momot, Scott Pack Jun 25 '13 at 19:22

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

5  
Get rid of this CPanel crap and start learning to administer the server the real way. This crap will always be in your way and prevent you from learning. –  Sven Jun 22 '13 at 12:12
    
can you access localy? with ssh user@localhost ? –  Brigo Jun 22 '13 at 12:17
    
@Brigo Thanks for your answer. I don't know any way to do this. The server is remote and I can't login into ssh because port 22 doesn't respond. I can't even access via ftp, so I am pretty much stuck. –  Emanuele Feliziani Jun 22 '13 at 16:10
    
@SvW I am trying to learn to administer the server the way I can, one step at a time. As you can see, I am not even able to connect via ssh. Thanks for taking the time to answer, but you didn't provide constructive help. –  Emanuele Feliziani Jun 22 '13 at 16:13
    
"Operation timed out" pretty much means that your packets aren't reaching the remote host, or the remote host's packets aren't reaching you. If you can reach the remote host on port 21 but not 22, then it's probably a firewall of some kind. –  Kenster Jun 23 '13 at 19:02

1 Answer 1

First off check that sshd is running

service sshd status 
openssh-daemon (pid  9535) is running...

or possibly

openssh-daemon is stopped

in which case you need to start it.

If it is running check that it's configured to listen on port 22 and your external IP address by looking at /etc/ssh/sshd_config.

If it is correctly configured to listen on port 22 then look at your firewall and ensure that it has port 22 open on your external ipaddress.

Yes I've delibrately left out some details. The reason for this is to allow you to read the documentation yourself and be educated.

share|improve this answer
    
Thanks for your answer. I can't access ssh, so I can't run these commands. Anyway, sshd is running with pid 15754 (I've seen this from the Current Running Processes page in WHM). Is there any other way for me to access the shell? –  Emanuele Feliziani Jun 22 '13 at 16:06
    
If the only problem was that sshd isn't running (or sshd was listening on the wrong port), then the error would be "connection refused" rather than "Operation timed out". –  Kenster Jun 23 '13 at 19:02
    
@Kenster: Starting at the beginning and working out –  Iain Jun 23 '13 at 20:23

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