Transfer using linux ssh and maintaining permissions
Posted
by
jbolt
on Super User
See other posts from Super User
or by jbolt
Published on 2010-12-09T20:08:53Z
Indexed on
2011/01/02
18:55 UTC
Read the original article
Hit count: 152
I need to transfer files across ssh to another server. The file structures are identical on both sides. I have used scp -r but that does not retain the orginal file/dir permissions. rsync does the job of keeping the permissions in tact but does not delete the files on the destination side if I want to overwrite them because of changes. I know rsync will write the changes when the source files are newer but I need it to just copy everything reguardless of the date (ie replace destination directory with the one I am moving) without having to shell into the destination first and manually delete the dir.
I heard tar can do this but I can not seem to get it to work without errors. The syntax is
tar -cf - /directory/directory | ssh host.name tar -xf - C /destination_directory
Any help would be appreciated.
© Super User or respective owner