PuTTY + FileZillaPortable FTP Tunnel 設定

Tools

Win7 + PuTTY + FileZillaPortable

Situation 1

目標: (A) 192.168.10.1:22 (support sftp)

跳板: (B) 192.168.1.1:22

Need to ftp to (A) but can only connect (A) through (B)

ftp→192.168.1.1:22(B)→192.168.10.1:22(A)

之前我只知道先Login到B→再Login到A→使用scp將檔案下載到B後→再ftp到B下載檔案.

今天學會了新的一招, Brilliant!

 

Solution (Only works on FTP server which supports sftp)

(localhost:5555→192.168.1.1:22→192.168.10.1:22)

Step 1. Open PuTTY→Session→Create a session: Host Name: 192.168.1.1, Port: 22 (跳板機)→Save

Step 2. Session→Load→(Step 1 created session)→SSH→Tunnels→Add Source port: 5555 (any unused local port), 192.168.10.1:22 (目標機)→Add (don’t forget)→回到Session→Save(don’t forget)

Step 3. Session→Click on Step 1 created session→Open→Login user/pwd (B 的 User/Pwd)

Step 4. Open FileZillaPortable→Site Manager→New Site→Host: localhost, Port: 5555, Protocol: SFTP, Logon Type: Normal, A 的 User/Pwd→Connect

此時就可經由Tunnel連接到目標機, 直接下載檔案了

在這當中, PuTTY的連線不可斷, 否則Tunnel就斷了 (Must open the PuTTY connection and leave it until you finish the rest of the work…)

Situation 2:

目標: (A) 192.168.10.1:21 (only support ftp)

跳板: (B) 192.168.1.1:22

When using solution 1, it will hang to execute LIST command (maybe about the configuration of the FTP server. Since we cannot modify it, all we can do is using another SSH trick…)

指令: EPSV
回應: 229 Entering Extended Passive Mode (|||29280|).
指令: LIST
(no response...)

Solution (Better Solution, also applies to situation 1)

192.168.10.1:21→192.168.1.1:22 (SOCKS 5 Proxy)→192.168.10.1:21

Step 1. Open PuTTY→Session→Create a session: Host Name: 192.168.1.1, Port: 22 (跳板機)→Save

Step 2. Session→Load→(Step 1 created session)→SSH→Tunnels→Add Source port: 9999 (any unused local port), 127.0.0.1 (Dynamic & Auto)→Add (don’t forget)→回到Session→Save(don’t forget)

Step 3. Session→Click on Step 1 created session→Open→Login user/pwd (B 的 User/Pwd)

Step 4. Open FileZillaPortable→Edit→Settings→Generic Proxy→SOCKS 5→Proxy Host: 127.0.0.1, Proxy Port:9999→Save

Step 5.Open FileZillaPortable→Site Manager→New Site→Host: 192.168.10.1, Protocol: FTP, Logon Type: Normal, A 的 User/Pwd→Connect

Reference

https://stackpointer.io/network/ssh-port-forwarding-for-ftp/208/

利用ssh-tunnel連線至內部網路

http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s