Clarification: UNIX cp command

Posted on 2006-05-04
Last Modified: 2013-11-17
I made a backup of a certain directory using cp command but I forgot to use -p to preserve the owners and permissions.

But I need to overwrite the new files with the backup copy. Can I do that by preserving the ownership and permission of the destination which is the newer copy.

Question by:jryanlee80
    LVL 45

    Accepted Solution

    Hi jryanlee80,

    Copying the files onto the existing files should not change the ownership or permissions associated with them.  (Try it.  Make a file from your user account and then copy a file onto it from root.)

    Just make sure that you are root for the copy so that you're sure to have access to all of the files involved.

    Good Luck!

    Author Comment


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now