Freepbx 13 or 12 : Backup and Restore creates empty folders because of Permission denied on source files

Bonjour,

J’utilise Freepbx sur un raspberry.
Tout est à jour.

FreePBX 12.0.76.3
Asterisk V11.22.0
Backup et Restore V12.0.19

J’ai créé un backup sur un FTP auquel j’accède parfaitement.

Lorsque je regarde le contenu de mon backup, les dossiers sont vides.
Par exemple, si j’ajoute le dossier /etc/exim4/ alors je retrouve bien ce dossier dans mon backup mais il est totalement vide.
Idem pour un dossier que j’ai créé dans /var/www/html/lbocfg où je stocke les configs de mes postes AASTRA… Le dossier est bien dans le fichier de backup mais il est vide.
Idem pour /etc/fail2ban/
Même le fichier /etc/freepbx.conf n’est pas sauvegardé !

J’ai donc tenté de créer une sauvegarde qui ne prend que mes dossiers --> Seuls les dossiers sont dans l’archive !

Quelqu’un à une idée ?

> Translation:

Hello, I use Freepbx on a raspberry.
Everything is up to date.

FreePBX 12.0.76.3
Asterisk V11.22.0
Backup and Restore V12.0.19

I have created a backup on an FTP that I accessed perfectly.

When I look at the contents of my backup, the folders are empty.
For example, if I add the /etc/exim4/folder then I well find this folder in my backup, but it is totally empty.
Ditto for a folder that I created in/var/www/html/lbocfg where I store my AASTRA posts configs. The folder is in the backup file, but it is empty. Ditto for/etc/fail2ban/even the /etc/freepbx.conf file is not saved!

So I tried to create a backup that only takes my folders — only folders are in the archive!

Someone have an idea?

I’d start by looking at the logs for the backup. I suspect you will find a username/password/permissions problem in the log file. Your FTP user may not have read access to the local files, or may not have write access to the destination directories, even though your are correctly creating them during the session.

Check the ownership of the directories you are creating. FTP includes some “interesting” options that can make file and directory operations not work as well as you would like.

Dear Dave.

I’m not sure that it is a right failure because files are missing Inside the tar.gz file.
Archive is correctly stored in the FTP server.
What it is wrong it is that the archive only contains folders, no files !

Any idea ?

Regards,
Laurent.

If the archive file is getting stored on the FTP server, there are a couple of possible problems:

  1. The user that owns the files on the “source” server is being retained and used on the “destination” server. There should be an option to use the “ftp” user’s credentials on the destination server. Since the directories are getting created correctly, one can assume that the credentials on the destination are all right.

  2. The source files on the “source” server aren’t readable by the backup program, and therefore are not getting included in the archive GZIP file.

I don’t mess with the backup program in FreePBX, but since almost everything else in FreePBX relies on an “asterisk” user, I’d probable make sure that these files you are wanting to backup can be read by “asterisk”, or whatever user is performing the backup.

Dear Dave.

Thanks for replying.
I do not understand why the backup module provided by Freepbx would not get the access rights on files of Freepbx. That would be a bug…

How can I check this ?

Regards,
Laurent.

From the console, log in as ‘root’, then use ‘su -m asterisk’ to switch your user to ‘asterisk’.

Use ‘ls’ and access each of the files you are having trouble with.

Remember, the other possibility is that the backup program is not running as ‘asterisk’. In that case, use ‘su -m’ and switch to the user that is running the backup program. Then, use ‘ls’ to check the files in question using that user.

Dear Dave.

After upgrading to Freepbx V13, save process is verbose.
I can get error logs directly on email sent from Freepbx.

You were right. There is a problem with access rights.
See below :
August 8, 2016, 2:11 pm - data: Backup Lock acquired! August 8, 2016, 2:11 pm - Backup Lock acquired! August 8, 2016, 2:11 pm - data: Running pre-backup hooks... August 8, 2016, 2:11 pm - Running pre-backup hooks... August 8, 2016, 2:11 pm - data: Adding items... August 8, 2016, 2:11 pm - Adding items... August 8, 2016, 2:11 pm - data: rsync: send_files failed to open "/etc/exim4/exim.crt": Permission denied (13) August 8, 2016, 2:11 pm - data: rsync: send_files failed to open "/etc/exim4/exim.key": Permission denied (13) August 8, 2016, 2:11 pm - data: rsync: send_files failed to open "/etc/exim4/exim4.conf.localmacros": Permission denied (13) August 8, 2016, 2:11 pm - data: rsync: send_files failed to open "/etc/exim4/exim4.conf.template": Permission denied (13) August 8, 2016, 2:11 pm - data: rsync: send_files failed to open "/etc/exim4/exim4.conf.template.dpkg-dist": Permission denied (13) August 8, 2016, 2:11 pm - data: rsync: send_files failed to open "/etc/exim4/passwd.client": Permission denied (13) August 8, 2016, 2:11 pm - data: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1] August 8, 2016, 2:11 pm - data: Building manifest... August 8, 2016, 2:11 pm - Building manifest... August 8, 2016, 2:11 pm - data: Creating backup... August 8, 2016, 2:11 pm - Creating backup... August 8, 2016, 2:11 pm - Storing backup... August 8, 2016, 2:11 pm - data: Storing backup... August 8, 2016, 2:11 pm - Saving file to remote ftp August 8, 2016, 2:11 pm - data: Saving file to remote ftp August 8, 2016, 2:13 pm - data: Running post-backup hooks... August 8, 2016, 2:13 pm - Running post-backup hooks... August 8, 2016, 2:13 pm - data: Backup successfully completed! August 8, 2016, 2:13 pm - Backup successfully completed!

My problem is “Why script generated by Freepbx do not have good access right ?”

Regards,
Laurent.

Submit this run with a ticket at the “Issues” tab at the top of the screen. This should solve some of the problems people are seeing.

Done !

Thanks.

Dear,

They closed the Issue because it’s a Third Party Issue !

This appears to be a support issue.
This system is setup for bug tracking only and does not handle support request or general questions.
If you require support or simply need answers you have several options.

Self Service:
http://wiki.freepbx.org
Community Forums with search
http://community.freepbx.org
Paid support.
http://support.schmoozecom.com

Thank you for using FreePBX
The James

Not a good news !

Laurent.