LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-15-2003, 09:13 PM   #1
pilot1
Member
 
Registered: Jun 2002
Location: USA
Distribution: Gentoo, Fedora Core
Posts: 408

Rep: Reputation: 30
Unhappy Preserving permissions when using cp


Is there a way I can preserve the permissions of a file when I use cp to copy it?
For example, say I want to copy /var to /mnt/nd/var.
Files in /var are owned by many different people, but when I copy the files from /var to /mnt/nd/var as root, the files are all owned by root.

How can I make it so that I can copy files, while not changing/perserving their ownership and permissions?
Thanks!
 
Old 08-15-2003, 09:17 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
cp has a option for this, -P you can chhose which bits it preserves.

the reverse option is --no-preserve.

On most basic commands (okay nearly all console commands)

typing
thecommand --help

gives you all the options and for more detailed info try
man thecommand
 
Old 08-16-2003, 05:29 AM   #3
pilot1
Member
 
Registered: Jun 2002
Location: USA
Distribution: Gentoo, Fedora Core
Posts: 408

Original Poster
Rep: Reputation: 30
Thanks for your help!
I was aware that I could find it by doing "cp --help" or looking at a man page, but this was a case where I didn't have access to either of those.

Last edited by pilot1; 08-16-2003 at 06:26 AM.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Preserving Permissions RemusX2 Linux - Software 2 07-10-2005 11:20 AM
mv: preserving times / setting permissions (FAT32) Samsara Linux - General 4 01-25-2005 06:57 AM
scp with preserving permissions pradi_net Linux - Software 1 06-08-2004 08:00 AM
preserving konsole colours kazuni Linux - Newbie 2 06-03-2003 08:18 PM
help on preserving applications when upgrading doublefailure Linux - General 5 10-01-2002 11:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:01 AM.

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