map a drive using ssh
i need to map a samba drive from windows xp sp3 using an ssh tunnel, could someone provide me with a comprehensive walk through of how to do this 1 person got this answerI do too
October 16th, 2009 5:28pm
Install this official Microsoft patch: Programs that connect to IP addresses that are in the loopback address range may not work as you expect in Windows XP Service Pack 2
Reboot
Click "Start" / "Settings" / "Control Panel":
Double-click "Add Hardware":
Click "Next"
Wait for this screen to go away:
Select "Yes, I have already connected the hardware" and click "Next":
Select "Add a new hardware device" and click "Next":
Select "Install the hardware that I manually select from a list" and click "Next":
Select "Network Adapters" and click "Next":
Select "Microsoft":
Select "Microsoft Loopback Adapter" and click "Next"::
Click "Next":
Click "Finish"
Click "Start" / "Settings" / "Network Connections":
Right-click "Local Area Connection x" and select "Properties":
Uncheck all items but "Internet Protocol (TCP/IP)":
Highlight "Internet Protocol (TCP/IP)" and click "Properties":
Enter a "Local" IP address. Local IP addresses include 10.x.x.x, 172.16.x.x, and 192.168.x.x. In this example, we'll use 192.168.10.1. Then click "OK":
Uncheck "Notify me when this connection has limited or no connectivity", and click "Close":
For Samba based systems, you can connect to 127.0.0.1. For Windows based systems, you need to connect to the system's local, or public IP address. If you don't already know the remote system's local IP address, you can run ipconfig on it to discover it. For example, using ssh, you would type:
C:\> ssh remote.example.com ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
If you are using putty, type:
C:\> cd /d "C:\Program Files\PuTTY"
C:\Program Files\PuTTY> putty remote.example.com
enter your username, and password, and then type ipconfig:
$ ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
$ logout
Establish an ssh connection and port forward port 139 from our loopback adapter's IP address (192.168.10.1) to the remote system's IP address discovered above (192.168.1.101). For example, using ssh type:
C:\> ssh -L 192.168.10.1:139:192.168.1.101:139 remote.example.com
If you are using putty, type:
C:\Program Files\PuTTY> putty -ssh -L 192.168.10.1:139:192.168.1.101:139 remote.example.com
If you want, you can add the username and/or password to the command line:
C:\Program Files\PuTTY> putty -ssh -L 192.168.10.1:139:192.168.1.101:139 -l user -pw pass remote.example.com
Run net use to map the network drive:
C:\> net use * \\192.168.10.1\sharename /user:"192.168.10.1\username" "password"
For example:
C:\> net use * \\192.168.10.1\c$ /user:"192.168.10.1\administrator" "admin password"
Drive Z: is now connected to \\192.168.10.1\c$.
The command completed successfully.
To port forward 139 every time you run ssh, add the following to your ~/.ssh/config file:
Host remote.example.com
LocalForward 192.168.10.1:139 192.168.1.101:139
Now, you can just type:
C:\> ssh remote.example.com
If you're using ssh, you can automatically establish this connection by installing and configuring the autossh package
MCP. MCDST. LVL 80
Free Windows Admin Tool Kit Click here and download it now
October 20th, 2009 6:43pm


