copy directory without changing ownership setting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers copy directory without changing ownership setting
# 1  
Old 08-17-2005
copy directory without changing ownership setting

hi

currently i am migrating some directories over to a new server. is there any command (rcp or ftp or anything) for me to use without changing the ownership and permission of the directory?
i am copying some directories from unix machine to linux machine. what is the exact command?
thanks Smilie
# 2  
Old 08-17-2005
The 'ownership' of a file that you see on (for example) the output from 'ls -l' is just a mapping from a uid to a username. These entries are stored in /etc/passwd. So if you copy a files from one machine to another and you wish the 'ownership' to remin the same then first of all both machines must contain entries for the same username with the same uid.

In its simplest terms there must be entries in both machines /etc/passwd files where fields 1 and 3 are the same.

There are many little quirks to maintaining both ownership and permissions when copying files, the easiest way is to tar all the files up on the one machine. Copy the tar file over using whatever method you wish and then untar it on the target machine.
# 3  
Old 08-17-2005
As Unbeliever said, both systems must have the same uids and gids matching the corresponding owner and group. If this is your case you can use rsync (http://rsync.samba.org) to copy or update (or synchronize) a directory tree.

Best regards!.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

User's Home directory ownership is changing Automatically

Hi , on my Solaris 10 machine user's home directory ownership is being changed automatically to their UID. can any one please tell me whats the reason behind it . users are there in /etc/passwd file . /etc/shadow file is also there along with nssswitch.conf file and there is no changes made to... (5 Replies)
Discussion started by: usernew
5 Replies

2. Shell Programming and Scripting

Changing ownership of a directory, subdirectory and files as same as in another server

accidentally i have changed ownership of a directory,subdirectory and files wil below command. I want to the change ownership back as same as in same directory on another server. How can i do it? chown -R user:group /u01 is there any simple script? it is really an urgent need.. (2 Replies)
Discussion started by: johnveslin
2 Replies

3. UNIX for Dummies Questions & Answers

Setting default directory file permissions and ownership help

I'm trying to setup a directory structure for my staff which enables them full access to files in the directories with their name, and have access to anything in the shared directory. The directory structure looks like this: root@www10 # ls -l total 56 drwxr-xr-x 7 internal internal 4096... (3 Replies)
Discussion started by: v_greg
3 Replies

4. Shell Programming and Scripting

Search and replace without changing ownership

I found this search and replace method on another site: find . -type f -print0 | xargs -0 sed -i 's/find/replace/g' It worked fine except for the fact that it changed ownership on all the files it went through. I discovered that when my site web server suddenly couldn't serve the pages it had... (10 Replies)
Discussion started by: dheian
10 Replies

5. UNIX for Dummies Questions & Answers

regarding changing ownership and group

i am able to change the mode using chmod and able to change permission. but i am not able to change group and ownership. getting as invalid can any one help me regarding this . (4 Replies)
Discussion started by: satheeshkr_cse
4 Replies

6. UNIX for Dummies Questions & Answers

changing ownership?

how would i change ownership of file1 so the user NATE gets ownership of the file? (1 Reply)
Discussion started by: trob
1 Replies

7. UNIX for Advanced & Expert Users

command to copy files with original ownership

Hi, I need a command that to copy files from others and to keep files' ownership. Example: I copy file.txt from users "abc" to my local, and file.txt is own by user "abc" in local. Thanks in advance! (3 Replies)
Discussion started by: need_help
3 Replies

8. Red Hat

changing wtmp ownership and permission

Hi, I am using redhat AS 3. Recently, I was asked to implement a security control on the OS: to change ownership of /var/log/wtmp to root:sys and permission to 600. However, when I made the change and reboot the machine, everything was reverted. How come? Please help. The following is the... (1 Reply)
Discussion started by: voa2mp3
1 Replies

9. UNIX for Advanced & Expert Users

File group ownership changing automatically

Hi everyone, Need help with an issue. The group ownership of files on my Solaris system is getting changed automatically. Could someone tell me the reason why? And how could I correct it? One more info- everytime the ownership changes, it changes to "x". Thanks :confused: (1 Reply)
Discussion started by: top_gun
1 Replies

10. Solaris

Diectory ownership ...changing

Help...... I am running a 420R w/sol 8 and I am trying to install sun's monitoring software srs netconnect. I have installed it on 6 other boxes with no problem. Installation failed with the message: ## Installing part 1 of 1. /etc/opt/SUNWsrspx/CustomerCert.pem... (6 Replies)
Discussion started by: finster
6 Replies
Login or Register to Ask a Question