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 set up a ssh server through ssh-host-config. Then I started the server.

net start sshd
The CYGWIN sshd service is starting.
The CYGWIN sshd service was started successfully.

When I try to connect I get:

ssh myusername@localhost
ssh: connect to host localhost port 22: Connection refused

I tried to allow port 22 in Windows Firewall, but that didn't change anything. And because I'm trying to ssh locally I don't think Windows Firewall is the culprit.

I'm using Windows 7 and

What should I look for to fix this problem?

share|improve this question
    
Enable telnet command and checking with telnet localhost 22? –  quanta Jul 28 '11 at 17:16
    
Can you post the output from 'netstat -an | grep 22' –  EightBitTony Jul 28 '11 at 17:24
    
@EightBitTony: the original poster is using Windows 7, he should use findstr instead of grep. –  quanta Jul 29 '11 at 2:39
    
$ netstat -an | grep 22 TCP 127.0.0.1:62522 0.0.0.0:0 LISTENING TCP 192.168.1.4:51585 65.222.174.80:80 ESTABLISHED –  Steven Wexler Jul 29 '11 at 6:27

2 Answers 2

It is clear from the netstat output that either sshd is not listening on port 22 or the service is not running (crash on start). Best place to look for in windows would be event viewer in control panel. Also in the services.msc, see if it logging. If it is logging , logs would tell you what is happening and hence you would find the fix. Open resource monitor and see if the process sshd is running.

share|improve this answer

From the netstat output (which you might want to move into your question), the SSHD daemon is not listening on port 22. Which probably means although it started, it then crashed or stopped.

Try running sshd -d -d

That will run sshd in the foreground with debugging turned on, and you can see if / why it's crashing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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