Preserve permission with scp

cpscp

SCP does not seem to preserve ownership stamps even if used with -p option.

scp -p /mysql/serv/data_summary.* some_server:/mysql/test/

The files are owned by mysql and I want the same ownership to be assigned on the destination server. I need to copy files as root on both servers due to some admin issues. I can not change to mysql@

Best Answer

Try to use rsync, it has a lot more benefits besides keeping ownership, permissions and incremental copies:

rsync -av source 192.0.2.1:/dest/ination

Besides that, since rsync uses ssh, it should work where scp works.