Score:4

Copying files and folders, such that access rights come from umask, like for new files and directories

in flag

How can I copy files to some destination folder such that

  1. Access rights are derived from umask, i.e. the copied files and folders should behave with this respect as if they have been newly created. - I know that one can apply chmod recursively to a directory branch and all subbranches, but that would also affect other files, not just the copied ones.
  2. The owner and group are taken from the destination folder.

Note: The SGID-Bit for the destination folder is set.

Score:1
cn flag
raj

You can't set owner from a destination folder. The owner is always the user who created the file (or the owner of the original file, if root performs cp with the -p parameter). You can, however, set the group from the destination folder if setgid bit is set on the folder (this should happen automatically).

To create copied files with the default umask, use cp command with the parameter --no-preserve=all.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.