# Unable to retrieve file from ftp server



## balanga (Oct 17, 2017)

I have set up ProFTP for anonymous `ftp` access but am unable to `get` certain files. If I `cd` to a particular directory and run `ls -al` files are displayed.

When I issue (for example) 
	
	



```
get wget.zip
```
 I get:-

```
bina
200 Type set to I
get wget.zip
local: wget.zip remote: wget.zip
229 Entering Extended Passive Mode (|||50246|)
550 wget.zip: No such file or directory
```

I've tried changing permissions and ownership but can't figure out what is wrong. 

Any ideas?


----------



## ShelLuser (Oct 18, 2017)

Most likely a firewall issue. Are you sure that all required ports have been added to the firewall?


----------



## balanga (Oct 18, 2017)

The ftp server is running on a remote VPS. I'm not aware of any firewall settings.


----------



## SirDice (Oct 18, 2017)

Can you show the whole output? Login, do an `ls`, then get the file. Post this whole, including the `ls` command. The error indicates the file doesn't exist. So you're either not in the correct directory or the file simply isn't there.


----------



## balanga (Oct 18, 2017)

SirDice said:


> Can you show the whole output? Login, do an `ls`, then get the file. Post this whole, including the `ls` command. The error indicates the file doesn't exist. So you're either not in the correct directory or the file simply isn't there.



I'm looking at my setup and can't find a configuration file anywhere... I guess I'll try reinstalling proftpd again....

There's a guide here which I'll follow... although I'm not sure if the proftp archive directory can be specified anywhere. I assume it should be /home/ftp.


----------



## SirDice (Oct 18, 2017)

Never assume anything. Always check and double-check.


```
-c,--config config-file
		   Specifies an	alternate config-file to be parsed at startup,
		   rather than the default configuration  file.	  [b]The  default
		   configuration file is /usr/local/etc/proftpd.conf[/b]
```
From proftpd(8). 

And 

```
: ${proftpd_config:="/usr/local/etc/proftpd.conf"}
```
In /usr/local/etc/rc.d/proftpd.


----------



## balanga (Oct 19, 2017)

SirDice said:


> Can you show the whole output? Login, do an `ls`, then get the file. Post this whole, including the `ls` command. The error indicates the file doesn't exist. So you're either not in the correct directory or the file simply isn't there.



~/.netrc

```
machine 176.122.227.32 login ftp password ftp macdef init
ls -al
cd pub
cd usr
cd local
cd www
cd apache24
cd data
ls -al
bina
get info.php
get /pub/usr/local/www/apache24/data/info.php
bye
```

Log:-

```
ftp 176.122.227.32
Connected to 176.122.227.32.
220 ProFTPD 1.3.5b Server (ProFTPD Default Installation) [::ffff:176.122.227.32]
331 Anonymous login ok, send your complete email address as your password
230 Anonymous access granted, restrictions apply
Remote system type is UNIX.
Using binary mode to transfer files.
ls -al
229 Entering Extended Passive Mode (|||41852|)
150 Opening ASCII mode data connection for file list
drwxr-xr-x   3 root     wheel         512 Oct 18 22:38 .
drwxr-xr-x   3 root     wheel         512 Oct 18 22:38 ..
-rw-r--r--   1 ftp      ftp          2336 Jul 10 12:05 This server is not secure, please read me (Time to Read: 1 minute).txt
drwxr-xr-x   3 root     ftp           512 Oct 19 04:31 pub
226 Transfer complete
cd pub
250 CWD command successful
cd usr
250 CWD command successful
cd local
250 CWD command successful
cd www
250 CWD command successful
cd apache24
250 CWD command successful
cd data
250 CWD command successful
ls -al
229 Entering Extended Passive Mode (|||2022|)
150 Opening ASCII mode data connection for file list
drwxr-xr-x   2 root     ftp           512 Oct 19 05:00 .
drwxr-xr-x   3 root     ftp           512 Oct 19 04:32 ..
-rw-r--r--   1 www      80             21 Dec 10  2016 info.php
-rw-------   1 root     wheel         191 Oct 19 04:51 netrc
226 Transfer complete
bina
200 Type set to I
get info.php
local: info.php remote: info.php
229 Entering Extended Passive Mode (|||13774|)
150 Opening BINARY mode data connection for info.php (21 bytes)
100% |***********************************|    21      118.54 KiB/s    00:00 ETA
226 Transfer complete
21 bytes received in 00:00 (0.41 KiB/s)
get /pub/usr/local/www/apache24/data/info.php
local: /pub/usr/local/www/apache24/data/info.php remote: /pub/usr/local/www/apache24/data/info.php
ftp: Can't access `/pub/usr/local/www/apache24/data/info.php': No such file or directory
bye
```

I can't figure out why I can retrieve info.php after `cd`ing to the directory but can't when using a path.... 

I just noticed that `wget` will work using a path...


----------

