Restore via FTP not showing directories

Hi

I’m running through our internal docs here and I’ve found that restoring a backup from an FTP server in FREEPBX doesn’t appear to be working. We’re running 3.211.63-6.

If you go to Backup and Restore, and click on Restore on the right, then click on the FTP server entry on the right we get a spinning wheel in the freepbx interface, then nothing.

The FTP server shows that Freepbx is trying to access a directory that doesn’t access. Here’s the FTP log;


NLST
150 Opening data channel for directory list.
226 Transfer OK
PORT 198,67,79,46,170,113
200 Port command successful
LIST -d1 */
550 Directory not found.
QUIT
221 Goodbye


The backup to the FTP site works fine and the uploaded TGZ is fine and can be manually copied to the FreePBX server and restored from there.

Any ideas why FTP restoration wouldnt work?

Olly

Anyone? This appears to have happen on the last few versions and we’ve tried using quite a few FTP servers now. There are a few forum posts on other sites from way-back implying this used to work though.

Can anyone confirm or deny it works or which file I might start looking at?

Olly

I posted this a bit ago. I have not looked into further.

If you do hear anything then do post it back here Alan, I’d love to get this working as it would give me real peace of mind.

oliverm

I am running Distro 2.210.62-6 and do not get the list of files.

You debug info is valuable. This might be a bug. You should probably open a ticket so the developers can look at it.

This is my log output

Fri Apr 19 16:54:57 2013 [pid 31058] CONNECT: Client "10.8.0.57" Fri Apr 19 16:54:57 2013 [pid 31058] FTP response: Client "10.8.0.57", "220 (vsFTPd 2.0.5)" Fri Apr 19 16:54:57 2013 [pid 31058] FTP command: Client "10.8.0.57", "USER teladmin" Fri Apr 19 16:54:57 2013 [pid 31058] [teladmin] FTP response: Client "10.8.0.57", "331 Please specify the password." Fri Apr 19 16:54:57 2013 [pid 31058] [teladmin] FTP command: Client "10.8.0.57", "PASS " Fri Apr 19 16:54:57 2013 [pid 31057] [teladmin] OK LOGIN: Client "10.8.0.57" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "230 Login successful." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "CWD /home/teladmin/customers/district87/district87-ipt1///" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "250 Directory successfully changed." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "TYPE A" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "200 Switching to ASCII mode." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "PORT 10,8,0,57,143,249" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "200 PORT command successful. Consider using PASV." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "NLST" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "150 Here comes the directory listing." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "226 Directory send OK." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "PORT 10,8,0,57,169,7" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "200 PORT command successful. Consider using PASV." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "LIST -d1 */" Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "150 Here comes the directory listing." Fri Apr 19 16:54:57 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "226 Transfer done (but failed to open directory)." Fri Apr 19 16:54:58 2013 [pid 31059] [teladmin] FTP command: Client "10.8.0.57", "QUIT" Fri Apr 19 16:54:58 2013 [pid 31059] [teladmin] FTP response: Client "10.8.0.57", "221 Goodbye." Fri Apr 19 16:59:31 2013 [pid 31054] [teladmin] FTP response: Client "10.8.0.57", "421 Timeout."

I’ve raised a bug report so let’s see what they say.

Here is what I discovered through further testing.

I have a backup job that runs every Sunday night on the FreePBX server. The job is named Weekly_Su. When the job runs it created a subdirectory on my FTP backup server called Weekly_Su and stores the backup files in that directory. The problem seems to be that when you attempt to do a restore the system is unable to retrieve the listing of the subdirectory nor the files in the subdirectory. If I move the files up one directory level then the files will show up in when you do a restore. This is clearly a bug.

I also added the subdirectory Weekly_Su to the path in the FTP server config in FreePBX. The files are then listed. The problem with this is that the next backup will create another Weekly_Su directory within the existing Weekly_Su directory.

What is the ticket number? If you don’t mind I would like to add my findings.

It’s 6490

create a second ftp server definition in freepbx with the appropriate path and use that definition for restore and the one without a path definition for backup

Now that is out of the box thinking!!! Great work around.

Nice work around, but a fix would be better :frowning:

This is a problem with FreePBX 2.11.0.0rc1.4 as well. Backup to FTP works, restore doesn’t list files. Not having success with work around either. I am not dealing with folders, just dumping to root.

Looks like it might be a problem with PHP and ftp_nlist edit

/var/www/html/admin/modules/backup/functions.inc/restore.php

changed
//use pasive mode
//ftp_pasv($ftp, true);

to

//use pasive mode
ftp_pasv($ftp, true);

I was then able to see files and perform a restore!