Unix/Linux Go Back    

UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

cp -p and permissions

UNIX for Dummies Questions & Answers

Thread Tools Search this Thread Display Modes
Old Unix and Linux 04-15-2002
Posts: n/a
cp -p and permissions

Hi all.
Her's what i want to do:
-> copy a file from /tmp to /usr/local/bin, and then give this file the default owner of /usr/local/bin.
My /usr/local/bin belongs to root:sys. When i detar the file mentionned, it keeps the rights it was created with.
How can i achieve what i want to do? A cp -p does not give the file the rights of the new directory...
This is something i'm doing over 400 servers..

Sponsored Links
Old Unix and Linux 04-15-2002
Kelam_Magnus's Unix or Linux Image
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
Join Date: Aug 2001
Last Activity: 24 February 2017, 5:03 PM EST
Location: San Antonio, TX,
Posts: 1,071
Thanks: 0
Thanked 7 Times in 6 Posts
The -p option preserves the orignal ownership of the file and datestamp and group rights.

If you just want to change the file ownership and group as you copy it to the new directory, do this.

cp /tmp/file1 /usr/local/bin; chown root:sys file1
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ksh; Change file permissions, update file, change permissions back? right_coaster Shell Programming and Scripting 3 09-30-2011 08:59 AM
permissions BeefStu Shell Programming and Scripting 1 11-15-2010 12:42 PM
permissions on ftp... aneuryzma UNIX for Dummies Questions & Answers 1 09-03-2009 04:42 AM
To give the "unzip" permissions & "create" file permissions Mike1234 HP-UX 3 03-02-2008 04:34 PM
help with permissions finster UNIX for Dummies Questions & Answers 2 04-09-2003 09:01 AM

All times are GMT -4. The time now is 10:39 AM.