[Solved] Permissions issue when copying recordings to external drive

Hi all,

I’ve just mounted a ReadyNAS to my FreePBX box. I want to backup the monitor directory to this drive using the command line.

Whenever I try to cp, the permissions of the folder that is created don’t allow the creation of files in it, so I have to continually run chmod 777 on the destination folders to reset it, and it keeps breaking with every new folder it creates.

What am I missing? Why is it doing this? I am copying as sudo to a 777 directory. I have even tried setting permissions to 777 on the source, but no dice. There has to be a better way, surely?

Thanks for any help.

As root add

cp --preserve

(man cp)

also consider

rsync -av --progress /old/location/ /new/location

Thanks. I thought I had tried using -p, but resetting all permissions again resolved the issue.

Once the cp is done, I will be reverting to rsync for ongoing incremental backups. Much appreciated.