Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: ssh: connect to host localhost port 22: Connection refused

16 Oct 2012   #1

ssh: connect to host localhost port 22: Connection refused

i am on windows-64 bit hp machne.
i installed first latest cygwin(from local directory) to run hadoop on windows,but forgot to install tcp_wrappers pacakge.
so i deleted everything in C drive related to cygwin,also .ssh folder & .bashrc.profile
& installed again cygwin freshly.

i follow this tutorial:-
& run below command (u can see this commands in snapshot)

trendwise@trendwise-HP ~
$ ssh-host-config

*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Generating /etc/ssh_host_ecdsa_key
*** Info: Creating default /etc/ssh_config file
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/READ ME.privsep.
*** Query: Should privilege separation be used? (yes/no) no
*** Info: Updating /etc/sshd_config file

*** Info: Sshd service is already installed.

*** Info: Host configuration finished. Have fun!

trendwise@trendwise-HP ~
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/trendwise/.ssh/id_rsa):
Created directory '/home/trendwise/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/trendwise/.ssh/id_rsa.
Your public key has been saved in /home/trendwise/.ssh/
The key fingerprint is:
93:50:59:ac:c2:3a:ff:db:33:7e:ab:a9:bb:34:a5:cf trendwise@trendwise-HP
The key's randomart image is:
+--[ RSA 2048]----+
| .+. |
| .. . |
| .. . |
| o... |
| . .S . |
| o + |
| o + |
| .. =o.. |
| .**E=.. |

trendwise@trendwise-HP ~
$ cd ~/.ssh

trendwise@trendwise-HP ~/.ssh
$ ls -l
total 5
-rw------- 1 trendwise None 1679 Oct 16 20:22 id_rsa
-rw-r--r-- 1 trendwise None 404 Oct 16 20:22

trendwise@trendwise-HP ~/.ssh
$ cat >> authorized_keys

trendwise@trendwise-HP ~/.ssh
$ ssh localhost
ssh: connect to host localhost port 22: Connection refused

when i am going to start ssh localhost it says that
"ssh: connect to host localhost port 22: Connection refused "(see snapshot)

In Services, "Cygwinsshd" as service is already present there,but not started,
i don't know how to remove it from services(see snapshot)

ssh: connect to host localhost port 22: Connection refused-cygwin_sshd_present.png

ssh: connect to host localhost port 22: Connection refused-cygwin_sshd_already_started.png

ssh: connect to host localhost port 22: Connection refused-port_22_refused.png

Any how i want to start sshd server to run hadoop on windows,what should i do with port,or any other option,,plz i am installing it from last 2 days

My System SpecsSystem Spec
23 Dec 2012   #2

win7 32bit(x86)

go to the "enviroment variables" (right click on computer-->properties-->advance .. -->enviroment variables)
click on "new" button: name="CYGWIN" value="ntsec tty"
then: start-->service.msc-->right click on cygwin service and start
now run blow command:
ssh-host-config -y

i'm working on hadoop too, i'll be happy if we could share our information, if you agree with me just mail to:

My System SpecsSystem Spec
23 Dec 2012   #3
A Guy

Microsoft Community Contributor Award Recipient

Windows 7 Home Premium x64 SP1

Welcome to Seven Forums mohammad59mt. Looks like a good help post. All geek to me though

A Guy
My System SpecsSystem Spec

17 Feb 2013   #4

windows7 ultimate 32 bit

Thanks for you valuable post mohammad59mt. I have followed the same steps as you mentioned but Now I am encountering another problem as
$ ssh localhost
Connection closed by::1

Please help me in this I am also trying to install CYGWIN to do some hands on Hadoop.

Thanks in advance for your reply.

My System SpecsSystem Spec
31 Jul 2014   #5

windows 7 x64
connection closed by ::1

i too have encountered with this problem while installing hbase. what to do??
My System SpecsSystem Spec

 ssh: connect to host localhost port 22: Connection refused

Thread Tools

Similar help and support threads
Thread Forum
Internet Connection refused - Can't connect to internet
Hey, I've had this problem for a few days now, and I have no idea what to do. I've tried looking up other problems, but none of them are exactly like mine, so I'm posting here to see if anyone can help. I can't seem to browse pages through browsers; Chrome gives me: "Error code:...
Network & Sharing
Connection refused on yahoo
On Firefox and Internet Explorer when I click my home button which is yahoo and it keeps telling me connection refused is anybody else getting this issue or is it me, and I will also say all my other webpages are loading just fine
Browsers & Mail
understanding USB port, USB hub, Host controller architecture
Lenovo B570 (laptop) Win7 HP, x64 SP1 I am not experiencing any problems. I am just trying to figure out how things work. I am exploring the relationships of the Host Controller, Root Hub, and USB Ports. Any helpful insight would be appreciated. This computer has four USB ports. I plugged...
Hardware & Devices
ODBC cannot connect to localhost
On a Win7Pro-32 system running in XP mode, I'm trying to use ODBC (v5.1.9) to connect to a MySQL db on localhost. Interestingly, when using a username with remote host privileges I am able to connect to a remote db - this tells me ODBC is installed and working properly. Yet when I try to connect...
Everytime i cant connect i get redirected to a web host
Hi Guys, Im having a problem where when I try and connect to a website that isnt available instead of getting the standard windows error saying a timout error occurred or whatever im not being redirected a hosting provider (who i installed their java applet a few weeks ago). Its happening...
Browsers & Mail
cmd could not connect to the host on port 23
Microsoft Telnet> o < to > not open connection to the host, on port 23: connect failed :( this has also not worked when i have tried to connect to a IP address and i would be happy if any one could help thanks, Dan:)
Network & Sharing

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 14:16.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App