Mounting your Nikhef home directory using SSH
for Windows 7

Introduction

This tutorial is for Windows 7 but contains mostly screenshots from the English version of Windows Vista. Separate instructions for other versions of Windows are also available: The instructions for Windows 2000/XP are also still available.
To be able to mount a Windows share over SSH we will need

This part of the tutorial is split into the following steps:
  1. As most people do not have a spare real network adapter in their computer, we will add an extra virtual network adapter by installing the Microsoft Loopback Adapter.
  2. After that, the network adapter must be properly configured.
  3. Furthermore, a Windows system driver needs to be tweaked.
  4. Next, reboot Windows to verify that we've been able to grab port 445 and to see if the smb and lanmanserver drivers are up and running.
  5. If the port was grabbed, but the drivers are not running, then create a task using the Windows Task Scheduler to start the drivers.
  6. Next, we set up a special PuTTY session with the right port-forwarding.
  7. Finally, we start PuTTY and mount our Nikhef home directory.

  8. For those wishing to undo the above steps follow the instructions at the bottom of this tutorial.

Installing the Loopback Adapter

To install the Loopback adapter follow these steps: You are now ready to configure your newly installed Loopback adapter. Even though Windows might not ask you to, reboot anyways (heey, it's a Microsoft OS ;-)).
From reports I've seen on the Internet a reboot is sometimes required for the loopback adapter to come up properly.

Configuring the Loopback Adapter

Now that your newly installed loopback adapter is up and running we must configure it properly:

Tweaking the 'SMB' driver

Now we first need to tweak a Windows system driver to overcome the thing that Microsoft broke. The root cause of the problem is that we need to access the file share using TCP port 445. However, when Windows Vista or 7 boots this port is grabbed by the system smb driver for all interfaces. By delaying the startup of the smb driver and by installing a portproxy rule we can circumvent this. This section explains how to do this: If all went well you should see something like
ConfigureConsole
The portproxy rule is persistent, so there should be no need to repeat this step after a reboot.
  • Alex Tymick reported that for Windows 64bit SP1 a different service needs to be reconfigured:
      sc config FDResPub start= demand
    
    I have not been able to confirm this, but if disabling automatic startup of the smb driver does not work then it's worth trying this one.

    Reboot and verify

    Note I've verified this tutorial on multiple Windows 7 Professional installations, patched fully at the date of writing (March 1st, 2018), and the above instructions were sufficient to grab TCP port 445 and to get the 'smb' and 'lanmanserver' drivers in a running state.

    Of course, now that we have disabled the automatic startup of the 'SMB' driver we have to reboot Windows before proceeding. This also shows the downside of the portproxy method: it is no longer possible to use local shares on the computer while this rule is active.

    Configuring PuTTY

    Set up a special PuTTY session with the appropriate port-forwarding:

    Putting it all together

    Now that we have configured both our loopback adapter and PuTTY we can put it all together and mount our Nikhef home directory as a Windows share:
    Congratulations!

    Mapping a network drive

    To make life even easier it might be handy to map a network drive to your Nikhef home directory:

    Control+Z! Undo! Undo!

    For those wishing to undo the CIFS-over-SSH trick follow these steps:
    1. Start a console window with elevated (Administrator) privileges.
    2. Restore the automatic startup of the smb driver by typing
        sc config smb start= auto
      
      NOTE the space after the start= !
    3. Remove the portproxy rule by typing
        netsh interface portproxy delete v4tov4 listenaddress=10.255.255.1 listenport=445
      
    4. Start a Device Manager by typing
        devmgmt.msc
      
      Expand the 'Network Adapters', right-click on Loopback adapter and select Uninstall.
    5. If necessary, use the 'Task Scheduler' from the 'Administrative Tasks' menu to delete the task 'Start SMB driver'
    That's all, folks!

    Comments to Jan Just Keijser | lastmod = 20/03/2018 11:46| visitors = 779