View Single Post
  #22  
Old October 23rd 18, 04:37 AM posted to alt.comp.os.windows-10,microsoft.public.windowsxp.general,comp.mobile.android
Arlen Holder
external usenet poster
 
Posts: 185
Default What's the best way to forward SMB TCP port 445 to something higher than 1024 on Windows?

On Mon, 22 Oct 2018 18:56:58 +0100, David Taylor wrote:

At least one of those methods works for a friend. Very timely!


In case it helps others, here's my running log file from my last tests,
earlier this morning, before I gave up on the FTP "net use" syntax.

Often, empirically, I find stuff that nobody else seems ot know about (sort
of like how an ant finds scraps of food), where some of the scraps below
may help others.

I'm pretty much done with the FTP "net use" syntax checks, but it's a
bitch, sometimes, to get the syntax correct because _most_ examples on the
net are for SMB, which has no concept of the "@SSL" & "@PORT" &
"://userasswd" and the "/USER:user password" syntax.

=== begin ad-hoc log ===
0. Starting with this freeware Android FTP server set to its defaults

https://play.google.com/store/apps/details?id=com.theolivetree.ftpserver
IP = 192.168.1.7
Port = 2221
Passive ports = 2300-2399
Home directory = SdCard
User name = francis
User password = francis
1. The 1st control is the simplest test, which is to construct this
syntactically correct web browser URI, which works just fine
in a Windows Firefox browsing session on Windows.

2. The next control is to use that exact URI as the address for a Windows
File Explorer "network location", which also works just fine:

3. The next control is that the Android FTP share mounts using Windows
NetDrive freeware which mounts the FTP share as a drive letter.
4. The next control is that the Android FTP share mounts with Windows
DirectNetDrive freeware as a drive letter.

So, we know that Windows has no problem mounting the FTP share as a
"removable drive" or using that FTP share as a "network location".

We may just not know the syntax to use for the "net use" command.

For FTP & WebDAV, "net use" syntax will need both a port & login
credentials, where we know that UNC specifies ports, but not login
credentials.
https://en.wikipedia.org/wiki/File_Transfer_Protocol
ftp://[user[assword]@]host[ort]/url-path
But we also know that "net use" handles UNCs & login credentials:

https://superuser.com/questions/344775/passing-unc-username-and-password-within-a-unc-path#344933
net use M: \\192.168.1.7@8080\DCIM /user:francis francis
net use N: \\192.168.1.7@2221\DCIM /user:francis francis

5. The next control is to start a freeeware WebDAV server set to defaults:

https://play.google.com/store/apps/details?id=com.theolivetree.webdavserver
IP = 192.168.1.7
Port = 8080
Home directory = SdCard
User name = not set
User password = not set
6. Where this URI works just fine in a Windows web browser session:
http://192.168.1.7:8080/DCIM/Camera
7. And where that same URI easily creates a Windows "network location":
http://192.168.1.7:8080/DCIM/Camera
8. More to the point, similar syntax works with the "net use" command:
net use X: \\192.168.1.7@8080\DCIM\Camera
The command completed successfully.

While that test alone handily proves "net use" handles more than just the
"SMB" protocol on TCP port 445, we haven't yet proven whether "net use" can
handle the FTP protocol on port 2221.

Testing UNC syntax will be based on this Microsoft documentation:

https://docs.microsoft.com/en-us/windows/desktop/api/davclnt/nf-davclnt-davgethttpfromuncpath
Where the syntax for Windows' Universal Naming Convention (UNC) is:
\\HostName[@SSL][@Port]\SharedFolder\Resource

9. Let's add login credentials to the WebDAV setup:
IP = 192.168.1.7
Port = 8080
Home directory = SdCard
User name = francis
User password = francis
And then we stop and restart the Android WebDAV server.
10. Constructing this URI, as a URL for a Windows web browser works fine:

11. That same URI works fine as a Windows "network location":

12. More to the point, let's now retry "net use" syntax with credentials:
net use X: \\192.168.1.7@8080\DCIM\Camera /user:francis francis
The command completed successfully.
http://www.bild.me/bild.php?file=2542487dir016.jpg
13. Moving closer to the desired URI, let's change WebDAV port magic:
IP = 192.168.1.7
Port = 8000
Home directory = SdCard
User name = francis
User password = francis
14. As expected, the web browser URI with that syntax worked fine:

15. And the "net use" UNC syntax with that port number also worked fine:
net use X: \\192.168.1.7@8000\DCIM\Camera /user:francis francis
The command completed successfully.
http://www.bild.me/bild.php?file=8381514dir017.jpg

Unfortunately, I can't get the WebDAV server to accept port 2221.
So I'll set the FTP server to accept port 8080 instead.
IP = 192.168.1.7
Port = 8080
Passive Ports: 8100-8199
Home directory = /storage/emulated/0
User name = francis
User password = francis

16. The Windows web browser worked fine:

17. The Windows "network location" worked fine:

18. But the Windows "net use" attempt failed:
net use X: \\192.168.1.7@8080\ /user:francis francis
System error 53 has occurred.
The network path was not found.
http://www.bild.me/bild.php?file=3626731dir018.jpg
=== end ad-hoc log ===
Ads