ssh (OpenSSH and PuTTY) Problem

#1
There are two desktop computers in my home:
One running Debian Linux and one running Windows 10.

They both access the Web through a wireless router (Verizon).

The issue is that I cannot access the Windows box via ssh (OpenSSH or PuTTY).
I am able to access the Linux box from the Windows box - via ssh (via both OpenSSH and PuTTY).

For the sake of simplicity and in order to eliminate Linux from the equation, I tried:
ssh localhost
ssh 192.168.1.2
ssh HOME

ssh matt@localhost
ssh matt@192.168.1.2
ssh matt@ HOME

(where localhost, 192.168.1.2, and HOME are all the Windows box).

None of those 3 worked - either in PuTTY or in OpenSSH.

I either get:
Connection to localhost closed by remote host.
Connection to localhost closed.

Or I get:
ssh: connect to host 192.168.1.2 port 22: Connection timed out


I wanted to make sure that I could access this PC from another in one way or another - so I went ahead and created a homegroup which this computer and another household Windows 10 (laptop) are part of. That other Windows 10 PC is able to access this PC (and, for what it's worth, this PC can access the laptop).

Note that a firewall runs on the Windows box. But I get the same results whether it's up or down.

Anyone know what's going on?
TIA, Matt
 


Last edited:

ussnorway

Windows Forum Team
Staff member
Premium Supporter
#2
Windows 10 does not trust localhost by default... you have to tell it to.
 


#3
Thanks for the quick response. How do I do that?
 


#5
New Thanks for the reply.

Unfortunately it still doesn't work:

I did:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "HOME"
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "localhost"
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.2"
.
And I tried:
ssh matt@localhost
ssh matt@HOME
ssh localhost
ssh HOME
.
They all give/return:
Connection to home closed by remote host.
Connection to home closed.

So I wanted to make sure that I could access this PC from another in one way or another - so I went ahead and created a homegroup which this computer and another household Windows 10 (laptop) are part of. That other Windows 10 PC is able to access this PC (and, for what it's worth, this PC can access the laptop).

Any idea what I should do?
Thanks again.
.
P.S., and BTW, I also tried:
PS C:\WINDOWS\system32> ssh 192.168.1.2
ssh: connect to host 192.168.1.2 port 22: Connection timed out
PS C:\WINDOWS\system32> ssh matt@192.168.1.2
ssh: connect to host 192.168.1.2 port 22: Connection timed out
 


Last edited:

ussnorway

Windows Forum Team
Staff member
Premium Supporter
#6
on all windows machines the network location of localhost is stored in a file on the operating hdd...
Code:
C:\Windows\System32\drivers\etc
... assumes c drive is the system drive.
Screenshot (11).png


in this location you will find a file called hosts... open it in notepad and see if you have any hosts listed, for example my home server is called nibbithost so I added that name into my system hosts file and allowed it past the firewall.
Code:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "nibbithost"
Screenshot (13).png


ps, you will need to add permissions before editing this file... add "everyone" then select full control (edit and save changes) then remove the everyone entry to relock the file against hacking.

Screenshot (12).png
 


Neemobeer

Windows Forum Team
Staff member
#7
Did you actually install a ssh server on the Windows box and also allow ssh port 22 inbound?
 


#8
Thanks once again for the replies. I've set the permissions to (forgive me while I do Unix-speak) 777. That is, I went into the Security tab on the Properties dialog and gave everyone and everything global access!

I have also opened port 22 in my McAfee firewall, but nowhere else. Should I?

I only installed OpenSSH and PuTTY. Do I need a Windows ssh server?

What about ftp, telent, rlogin, and even old-school rsh - I cannot get any of those to run either - and they don't need an ssh server, do they?
 


Neemobeer

Windows Forum Team
Staff member
#9
You need a ssh server on Windows
 


#10
Hi,
Thanks for the reply.
I installed Powershell server and it is running:
PS C:\Software\Java\Projects\NetBeans\Overlord\dist> ps

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
150 14 3376 8960 88 0.03 8472 apcsystray
183 20 3116 11288 104 2804 AppleMobileDeviceService
110 8 1220 5560 53 2728 armsvc
121 11 7224 7652 53 1660 atkexComSvc
180 11 9944 11648 4096 0.41 1996 audiodg
42 4 1672 3076 4096 0.02 6188 cmd
.......<SNIP>.......
442 58 35300 55460 591 3544 PowerShellServer
.......<SNIP>.......

--------------

Here's what I get:
Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

PS C:\Software\Java\Projects\NetBeans\Overlord\dist> ssh HOME

****USAGE WARNING****

This is a private computer system. This computer system, including all
related equipment, networks, and network devices (specifically including
Internet access) are provided only for authorized use. This computer system
may be monitored for all lawful purposes, including to ensure that its use
is authorized, for management of the system, to facilitate protection against
unauthorized access, and to verify security procedures, survivability, and
operational security. Monitoring includes active attacks by authorized entities
to test or verify the security of this system. During monitoring, information
may be examined, recorded, copied and used for authorized purposes. All
information, including personal information, placed or sent over this system
may be monitored.

Use of this computer system, authorized or unauthorized, constitutes consent
to monitoring of this system. Unauthorized use may subject you to criminal
prosecution. Evidence of unauthorized use collected during monitoring may be
used for administrative, criminal, or other adverse action. Use of this system
constitutes consent to monitoring for these purposes.


matt@home's password:
Connection to home closed by remote host.
Connection to home closed.
PS C:\Software\Java\Projects\NetBeans\Overlord\dist>

-------------

BTW, here's my C:\Windows\System32\drivers\etc\hosts file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.1.2 HOME
192.168.1.3 MORROWS
0.0.0.1 mssplus.mcafee.com

--------------

Here's my hosts file listed:
PS C:\> Get-ChildItem -File C:\Windows\System32\drivers\etc\hosts

Directory: C:\Windows\System32\drivers\etc

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/12/2016 8:22 AM 889 hosts

(Also, see photo in next reply)


---------------------
Any ideas?
 


Last edited:
This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.
Top