iesmatauw / win-sshfs

Automatically exported from code.google.com/p/win-sshfs
0 stars 0 forks source link

Can not map with port forwarding unless I change the hostname #115

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Installed win-sshfs on Windows 7
2. Setup up openssh-server on Ubuntu 14.04 in a VirtualBox VM
3. Setup port forwarding from 2222 on localhost to 22 on guest
4. Configured a drive using localhost as the host and 2222 as the port
5. Got Server actively refused the connection error.
6. For giggles, changed the host name to a name that I had mapped in my windows 
hosts file: d7.dev
7. Connected again and it worked

What is the expected output? What do you see instead?
I would think that a connection localhost:2222 would work as long as I had the 
port forwarding enabled. WinSCP does work with that configuration.

What version of the product are you using?

win-sshfs: 0.0.1.5
Client OS: Ubuntu 14.04
Server OS: Windows 7
Ssh server: Openssh OpenSSH_6.6.1p1 Ubuntu-2ubuntu2, OpenSSL 1.0.1f 6 Jan 2014

Please provide any additional information below.

Original issue reported on code.google.com by rhuffste...@gmail.com on 9 Jan 2015 at 12:30

GoogleCodeExporter commented 9 years ago
"4. Configured a drive using localhost as the host and 2222 as the port"
"5. Got Server actively refused the connection error."

so you did this on your windows box, right?

"3. Setup port forwarding from 2222 on localhost to 22 on guest"
And this you did on your VM "Host", right ?

So if you set up a port forwarding on your VM Host pointing to a port on your 
VM (guest), DOES NOT make it known to your windows box automaticaly. So if you 
now ""4. Configured a drive using localhost as the host and 2222 as the port" 
windows would look the ip/hostname and port up ON ITS OWN (localhost) and will 
NOT find anything. BUT... if you additionaly setup your windows hosts file ("I 
had mapped in my windows hosts file") and add your VM Host with its IP address 
there, then windows knows where to look for the connection/port and all that 
jazz. So to me it looks pretty obvious since your windows does not do the port 
forwarding and not run any services like the sshd etc , that it does reject any 
incoming ssh connections .

to me that looks like a problem of the user, lack of understanding how the 
things work and where is what. NOT like a problem of the sshfs client itself. 

please correct me if i am wrong. 

regards
Axel

Original comment by axel.werner.1973@gmail.com on 10 Feb 2015 at 9:23

GoogleCodeExporter commented 9 years ago
Hi Axel,

Let me clarify the steps and add an additional test step.

1.Installed win-sshfs on Windows 7 (the host OS)
2. Setup up openssh-server on Ubuntu 14.04 (the guest OS) in a VirtualBox VM
3. In the VirtualBox settings for the virtual machine, setup port forwarding 
from 2222 on localhost (the host) to 22 on guest
3A (NEW test step). Opened putty on the host and successfully connected to the 
client over the port forward by sshing to localhost, port 2222.
4. Configured a drive in Winsshfs (on the host) using localhost as the host and 
2222 as the port
5. Got Server actively refused the connection error.
6. For giggles, changed the host name to a name that I had mapped to 127.0.0.1 
in my windows hosts file (on the host): d7.dev
7. Connected again and it worked

Having done a little more research, I'll split the difference with you. I 
wouldn't call it user error, because it's a reasonable expectation to work, but 
the reason it doesn't is not a coding issue in the client. Let me explain.

Here's the relevant line from my hosts file:
127.0.0.1   d7.local d7.dev samples.dev

So, d7.dev should be exactly equivalent to localhost, unless windows is doing 
something odd. Just as an additional data point, I just attempted to create a 
drive where I used the loopback IP (127.0.0.1) rather than a hostname, but this 
is not allowed. It gives "Hostname not valid", which I assume is intentional 
because of key validation.

Actually, "windows is doing something odd" may be the root cause here. I just 
noticed that an nslookup on localhost returns 127.0.0.1:

C:\Users\29007>nslookup localhost
Server:  UnKnown
Address:  10.0.0.1

Non-authoritative answer:
Name:    localhost.icfconsulting.com
Address:  127.0.0.1

But, pinging localhost gives me [::1:]
C:\Users\29007>ping localhost

Pinging ICF2004459.ICFI.icfconsulting.com [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

It's apparently a matter of which interface(s) the VBox port forwarding is 
listening on if I am interpreting this stackexchange question correctly:

http://superuser.com/questions/414050/why-is-there-a-difference-between-ping-loc
alhost-and-ping-local-ip-address

So, my recommendation would be that it's either a doc fix to say "beware of 
using localhost" or add a little contextual help or a warning message on 
submission if a user tries localhost as the hostname.

Thanks!

Original comment by rhuffste...@gmail.com on 10 Feb 2015 at 1:27

GoogleCodeExporter commented 9 years ago
thanks. that clears up the confusion a lot. :)

Original comment by axel.werner.1973@gmail.com on 10 Feb 2015 at 2:52