Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to SSH into my host. I'm using Mac OSX. When in terminal I type:

ssh user@hostname

I get an immediate error message stating:

connect to host port 22: connection refused

I've tried SSHing into my EC2 instance(different host altogether) and I can do that just fine. Any idea what the problem might be or what further troubleshooting I can do to find out the problem and fix it?

share|improve this question

closed as off-topic by mdpc, Ward, dawud, TheCleaner, gWaldo Sep 3 '13 at 17:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Ward, dawud, TheCleaner
If this question can be reworded to fit the rules in the help center, please edit the question.

you'll need to provide more information. try verbose logging. have you ever been able to connect. what's the history of this host? have you checked firewalls? is ssh running (check out of band)? – Drew Khoury Sep 3 '13 at 6:22

This indicates that the ssh daemon is not running or that there is a firewall set to reject the connection.

share|improve this answer

On the system you are trying too sh to, run the following:

ps aux | grep ssh
netstat -tulpn | grep 22

You dont specify what operating system the target host is. If its Mac you may have to modify the netstat command line parameters. But simply, you need to list listening ports, and grep for port 22 which is what ssh runs on.

If you get no output from either of the above, especially the second command, then you sshd daemon is not running, and you will need to start it before you can connect.

That said, an immediate error would suggest ( as Richard mentioned ) that a firewall is blocking the connection.

share|improve this answer

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