Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-19-2008, 09:47 AM   #1
Registered: Jan 2006
Posts: 65

Rep: Reputation: 15
Question How can I maintain ownership copying from one machine to another?

I have taken a snapshot of a rhel4 system and booted it on another system, but one of the filesystems I need to manually recreate by copying it from the old system to the new system. Since these systems are identical, all the users and their UIDs should be the same.

How can I copy from one machine to the other and maintain both permissions and ownership? Could I use RSync? If I've already copied the data while maintaining the permission structure (but not the ownership) can I just rsync the data to fix the permissions, or will that just recopy the file, or just ignore it all together?

Any help on this topic would be greatly appreciated!

Thank you.
Old 08-19-2008, 09:55 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,821
Blog Entries: 15

Rep: Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664
tar stores the UIDs so bundling it and copying over would work so long as the UIDs on target system are same.

rsync does preserve owner, group, permissions, times etc... There are flags for most of these but the short cut that usually works is:

cd to the directory you want to copy then run:
rsync -avz -e ssh ./ root@targethost:/targetdir

The -a is archive which implies most of the flags needed to keep the copies exactly the same. The -v is verbose and the -z compresses before transfer and uncompresses on target. The -e ssh tells it to use ssh for the shell.
Old 08-19-2008, 12:04 PM   #3
Registered: Jan 2006
Posts: 65

Original Poster
Rep: Reputation: 15

fantastic...I had already been tarring over SSH, but didn't do it as root on the destination system, so the perms didn't transfer. But, using the rsync command supplied with root this time, I was able to fix the perms in seconds without the need to resend all data. Thank you for your timely information.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
installation by copying it from one machine to another machine betrussell23 Linux - Newbie 5 03-05-2007 10:56 AM
change ownership on files written by apache/php to maintain effective quotas untoldone Linux - Software 2 01-14-2005 08:18 PM
Strange speeds copying files to gateway machine Kristijan Linux - Networking 2 07-30-2004 07:32 AM
Reading data from floppy (on Linux) and copying to Windows Machine yrraja Linux - General 1 07-30-2003 09:36 AM
How does one maintain a linux PC? bxb32001 Linux - General 7 06-16-2001 02:28 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration