# Problems getting FTP_PROXY to work



## johnblue (Aug 22, 2016)

So there is a proxy that I am required to route traffic through.  HTTP works without issue when updating the OS, for example.

Some of the env settings that are in play:

```
$ env
SSH_CLIENT=1.7.1.6 50655 22
LOGNAME=jblue
PAGER=more
MAIL=/var/mail/jblue
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/jblue/bin
EDITOR=vi
ENV=/home/jblue/.shrc
PWD=/usr/home/jblue
TERM=vt100
SSH_TTY=/dev/pts/0
HOME=/home/jblue
USER=jblue
SSH_CONNECTION=1.7.1.6 50655 1.5.4.8 22
SHELL=/bin/sh
BLOCKSIZE=K
ftp_proxy=http://proxy.dude.com:8080
http_proxy=http://proxy.dude.com:8080
```
FTP can see the proxy as an option:

```
$ ftp
ftp> set
anonpass        jblue@
ftp_proxy       http://proxy.dude.com:8080
http_proxy     http://proxy.dude.com:8080
no_proxy
pager           more
prompt          ftp>
rprompt
```
When I try to use FTP:

```
ftp> open
(to) ftp.freebsd.org
Trying 96.47.72.72:21 ...
^C
```
... tcpdump shows that the host does not even try to talk to the proxy:

```
jblue@hostname:~ # tcpdump -n -i vmx0 host 96.47.72.72
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vmx0, link-type EN10MB (Ethernet), capture size 65535 bytes
13:07:24.724866 IP 1.5.4.8.29449 > 96.47.72.72.21: Flags S
13:07:26.522761 IP 1.5.4.8.29013 > 96.47.72.72.21: Flags S
13:07:29.551817 IP 1.5.4.8.29013 > 96.47.72.72.21: Flags S
```
I have visited with the proxy admins and they indicated that port 8080 will accept FTP traffic.  I feel like I am chasing my tail on this because of shotgunning different configs.

Any thoughts would be appreciated.

Thanks!


----------



## windscape (Aug 23, 2016)

Hi johnblue,

Try using fetch instead of ftp. Its man page indicates that it uses the ftp_proxy environment variable.


----------



## Murph (Aug 24, 2016)

I believe that ftp(1) only uses HTTP-type proxies for fetching URLs.  I.e. you can't do traditional open->cd->get interactive style of FTP with it via a HTTP proxy.  If you do something like `ftp ftp://ftp.example.com/path/file`, it should work with your proxy setup.  For traditional interactive FTP, you need to be directly talking to the remote server or using the less common FTP proxy/gate functionality.


----------

