What should I change in remote shell command line in order to save the users groups and permission

I use the following line in order to copy one directory
 to another directory on another machine.

tar cf - .|rsh <ip address>
 '(cd <destination dir>;tar xBvf -)'

the problem is that all fileswere created with  root as owner.
What can I change in this command in order to transmit the dir with all owners permissions and groups
tzahiAsked:
Who is Participating?
 
toToConnect With a Mentor Commented:
first the user id in the 3de field of /etc/passwd must
be the same number on both hosts.

switch from tar to cpio , when used by root, it maintains user
informations

find . -print | cpio -ocB | rsh <ip address>
      '(cd <destination dir>; cpio -icdvB)'

 
0
 
tzahiAuthor Commented:
Edited text of question
0
 
ahoffmannCommented:
tar xpBvf -

unfortunatelly tar options highly depend on the UNIX flavior,
you'va to tell us you UNIX.
0
 
arthurdCommented:
Try adding the "p" option to tar.  This will preserve the permissions and ownerships.


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.