preserve permission with scp

Solution 1:

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.

Solution 2:

That is correct. "-p" does not do that. See the man page:

     -p      Preserves modification times, access times, and modes from the
             original file.

Notice it says times and modes, NOT user/group ownership. You will have better luck with "rsync", as it has various capabilities around preserving permissions when copying between disparate systems. "-p" in rsync, for example.

Tags:

Scp

Cp