简体   繁体   English

tar中的-C选项更改父目录权限

[英]-C option in tar changes parent directory permission

related to Tar without retaining directory and tar creation without directory to be retain 不保留目录的Tar和不保留目录的 tar创建有关

Hi All, 大家好,

Thanks for making understand -C use to create a tar(tar -cf a/b/c/tarfile.tar -C a/b/c .) without retaining directory structure. 感谢您理解-C在不保留目录结构的情况下用于创建tar(tar -cf a / b / c / tarfile.tar -C a / b / c)。

But when i un-tar its changing parent directory permission. 但是当我解压缩它更改的父目录权限时。 Please help me understanding more about it. 请帮助我更多地了解它。 It should not change parent directory permission while extracting tar(tar -xvf). 提取tar(tar -xvf)时,不应更改父目录权限。

The command 命令

tar -cf a/b/c/tarfile.tar -C a/b/c .

has an entry for . 的条目. (the directory which you are tarring). (您要归档的目录)。 When you extract the tar, that directory's permissions apply. 提取tar时, 应用目录的权限。 If you do not want this behavior, you can either 如果您不希望出现这种情况,则可以

  • specify the names (other than just ".") that you put into the tar file, eg, tar -cf a/b/c/tarfile.tar -C a/b/c foo 指定您放入tar文件中的名称(不仅仅是“。”),例如tar -cf a/b/c/tarfile.tar -C a/b/c foo
  • specify the names of the items you want to extract . 指定要提取的项目的名称。 You can see what is available using tar tvf using your tarfile as the parameter. 您可以使用tarfile作为参数,使用tar tvf查看可用的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM