2 ms·
On top of what others said, creating a copy of an existing directory isn’t trivial. You have to copy - owner and group, - rwx flags, - OS-specific flags
by Someone 5y ago
On top of what others said, creating a copy of an existing directory isn’t trivial. You have to copy
- owner and group,
- rwx flags,
- OS-specific flags such as the FreeBSD immutable ones,
- ACLs,
- extended file attributes
- possibly stuff I forgot
Some of these you should set before copying in the files for security reasons, some of these you can only set after doing that.
If the directory isn’t writable, for example, you can’t simply create it writable, copy in the files, and make the directory read only, as that opens a hole where others can write files to the directory.
I think the only safe way is to create a directory that’s only readable and writable by you, copy in the files, then set the attributes right.