Saturday, November 04, 2006

Samba over SSH

Last night I tried to connect a Windows XP machine to a Samba server on FreeBSD. I follow a nicely written webpage by Edwin Olson but failed for many trials. At last, I found that I missed out some important steps from that webpage and after I followed also those steps, it succeeded! A lesson for reading instructions carefully.

There are two reasons for using Samba over SSH:
  1. The port 139 is blocked for the outside connection to Samba server machine.
  2. SSH can encrypt the packets transferred, so that it gives better security for Windows file sharing.
Here is a summary of the configuration steps for the Windows machine.
  • Install a loopback network adapter for SSH port fowarding (or follow the steps from Microsoft):
    1. Go to Control Panel -> Classic View -> Add Hardware
    2. Choose "Yes, I have already connected the hardware"
    3. Choose "Add hardware device" from the bottom of the list
    4. Choose "Install the hardware that I manually select from a list"
    5. Choose "Network adapters"
    6. Choose Microsoft -> Microsoft Loopback Adapter
  • Configure the loopback adapter:
    1. Go to Control Panel -> Classic View -> Network connections
    2. The new loopback adapter should be called Local Area Connection 2
    3. Right click on it and choose Properties.
    4. Enable "Client for Microsoft Networks"
    5. Disable "File and Printer Sharing for Microsoft Networks"
    6. Click Properties of Internet Protocol (TCP/IP)
    7. Enter an IP address such as 10.0.0.1, subnet mask 255.255.255.0
    8. Click Advanced -> WINS
    9. "Enable LMHOSTS lookup" and "Disable NetBIOS over TCP/IP"
  • Connect to the Samba machine through SSH:
    1. Download and install PuTTY from PuTTY webpage.
    2. Start PuTTY.
    3. Go to Connection -> SSH -> Tunnels.
    4. In source port, enter 10.0.0.1:139
    5. In destination, enter 127.0.0.1:139
    6. Click Add
    7. Then enter your host name as usual for SSH connection and click Open
    8. After you have connected successfully to the Samba machine through SSH, the port forwarding should be OK.
  • The connection should be ready and you can access the files on Samba machine by:
    1. Click Start -> Run
    2. Enter \\10.0.0.1
    3. You should see the files shared by the Samba machine
Notes:
  • You may need to enable port forwarding of SSH on the server machine.
References:

No comments:

Post a Comment