scp and file owner

1,987

Solution 1

From man scp:

-p      Preserves modification times, access times, and modes from the
        original file.

You can see the -p option does not preserve ownership.

If you want to preserve file ownership, you can use rsync with -o and -g, which will preserve owner and group. This requires you to run rsync as root.

Solution 2

When you scp, the ownership comes from the user you use to scp to the other machine. For example:-

scp FILENAME USER@HOSTNAME:/PATH/TO/DESTINATION/

The ownership of FILENAME at the host HOSTNAME after scp will be USER as owner and primary group of USER as its group ownership.

Share:
1,987

Related videos on Youtube

Valeriane
Author by

Valeriane

Updated on September 18, 2022

Comments

  • Valeriane
    Valeriane almost 2 years

    I'm using PDFObject for my application :

    var myPDF = new PDFObject({
        url:myUrl,
        id:"myPDF",
        width:"100%",
        height:"100%",
        pdfOpenParams:{
            navpanes:1,
            statusbar:0,
            toolbar:1,
            view:"FitH",
            pagemode:"bookmarks",
            page:anchor
        }
    })
    
    var fullText = functionGettingResults()
    

    I want added dinamically search : fulltext in pdfOpenParams.

    myPDF.pdfOpenParams.search = fullText not works

    How I can ?

    thx

    • Prime
      Prime over 5 years
      Just tar the files you want to copy with -p, scp the tar, and untar on the destination with -p as well.