参考链接:
cannot change ownership to uid ***, gid ***
Linux tar: Cannot change ownership to […]: Permission denied

tar命令解压时,出现 cannot change ownership to uid ***, gid ***

解决办法:

使用tar命令的 --no-same-permissions 参数选项或者 尝试 --no-same-owner options 参数选项

tar --no-same-owner -xzf XX.tar.gz
————————————————
版权声明:本文为CSDN博主「mxdxm8899」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/mxdxm8899/article/details/84606302


In a script I was working on, the tar command always reported the following error when I tried to extract an archive:

Cannot change ownership to uid 1000 , gid 1000: Permission denied
But I was executing the script as root! The reason for this error to occur turned out to be relatively simple. Hint: It has to do with CIFS.

The command in the script looked something like this:

tar xzf $INPUT_FOLDER/archive.tar.gz -C /mnt/test-nas/[..]

So tar tried to extract the contents of the archive to /mnt/test-nas/[…] and failed (even as root). It turns out that tar tries to preserve the file permissions when run as root:

 -p, --preserve-permissions, --same-permissionsextract information about file permissions (default for superuser)

Since the filesystem /mnt/test-nas/ was mounted via SMB, even root had trouble setting the correct permissions and therefore failed. You can get around this problem by specifying --no-same-owner, so tar won’t try to set an owner:

tar xzf $INPUT_FOLDER/archive.tar.gz --no-same-owner -C /mnt/test-nas/[..]

tar: cannot change ownership to uid ***, gid ***: Operation not permitted相关推荐

  1. chmod 报错Operation not permitted

    使用 命令:chmod -r 777 hosts 修改文件权限时报了下面的这个错误: chmod: Unable to change file mode on hosts: Operation not ...

  2. Dockerfile中npm中Error: could not get uid/gid问题的解决方法

    Dockerfile中npm中Error: could not get uid/gid问题的解决方法 参考文章: (1)Dockerfile中npm中Error: could not get uid/ ...

  3. 修改uid gid 的起始范围

    修改uid gid 的起始范围 /etc/login.defs # # Min/max values for automatic uid selection in useradd # UID_MIN ...

  4. UID GID 说明及例子

    转载自:http://www.mamicode.com/info-detail-1464105.html Linux用户:Username/UID   (用户的名称和用户的UID) 管理员:root, ...

  5. Linux中UID, GID, EUID, EGID,SUID、SGID讲解

    UNIX下关于文件权限的表示方法 通常我们使用ls -l查看文件的权限.通常我们可以得到10位的权限表示法,如:-rwxr-xr-x.我们对于以下格式进行解析: 9 8 7 6 5 4 3 2 1 0 ...

  6. linux 修改 gid uid,uid, gid, setuid, setgid

    程序和进程 一般而言,程序是一个可执行的文件,而进程是程序执行的实例,一个程序可以产生任意多个进程,这些进程具有相同的代码. 用户名/组名和uid/gid 每一个用户具有一个用户名和组名以及对应的ui ...

  7. chown: changing ownership of ‘ypj’: Operation not permitted

    1.linux环境下,chown命令报错信息如下: chown root ypj chown: changing ownership of 'ypj': Operation not permitted ...

  8. nfs参数介绍与写法示例及报错( Operation not permitted)

    一. NFS各版本通用参数 soft/hard [参数说明]软挂载方式挂载系统,若NFS请求超时,则客户端向调用程序返回错误:如果使用硬连接方式则客户端一直重新请求直至成功.默认为hard. [使用建 ...

  9. rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

    今天在同步数据的时候提示rsync: failed to set times on "xxxx": Operation not permitted,一般来说要不是服务器时间不对或者 ...

最新文章

  1. 2022-2028年中国节能建材行业深度调研及投资前景预测报告
  2. remote_os_authent参数测试!
  3. java aio socket_java核心学习(三十三) 网络编程---AIO实现异步Socket通信
  4. Git 的安装及配置
  5. 关于open***的实验总结
  6. outlook qr码在哪里_优势对比:阜阳洋葱店邀请码
  7. 一篇故事看懂从 session-cookie 到 JWT 的技术演变
  8. 基于Spring Boot 的Blog开发(一)
  9. Linux终端下输出二维码
  10. zblog php主题,天兴工作室:zblogphp视频站主题(新增会员中心+盈利系统)
  11. 第四章 基于QT和DCMTK的Dicom 图像浏览器---检查文件夹下Dicom序列个数
  12. 小熊派BearPi-IoT(GD)之IoT Studio开发环境搭建
  13. Oracle12c CDB和PDB数据库的启动与关闭说明
  14. js-table2excel 导出带图片的excel
  15. 常识推理问答相关最新研究进展
  16. 微型计算机存容量基本单位,在微型计算机中,存储容量的基本单位是什么?
  17. 美国习惯用语flip out的中英文翻译解释和例子
  18. C#中感叹号(!) 的作用总结
  19. 使用Java API访问HFDS
  20. 计量经济学及Stata应用 陈强 第七章异方差习题7.3

热门文章

  1. 视频直播源码中主播印象功能开发
  2. 关键词提取-基于python实现tf-idf
  3. 商务邮箱e-mail地址格式是什么意思?解读mail使用场景及功能
  4. 三菱PLC模板程序FX5U轴FB块 使用ST语言编写的轴FB块,包含原点复归,点动
  5. BUUCTF:Had a bad day
  6. 2018上半年移动办公OA系统行业分析
  7. python基础——3、python应用(日期、文件、词云统计)——(YZ)
  8. 【Java】正则表达式(不)包含某个字符串,(不)以某字符串开头
  9. 4个不为人知的Excel表格填充技巧,让你在制作表格时候如有神助!
  10. CN域名和手机号码实名制