chmod 报错 changing permissions of 'xxx': Operation not permitted
chmod 报错 changing permissions of 'xxx': Operation not permitted
问题
- 使用root创建了一个子用户,在home目录下创建对应的文件夹
- 更改文件夹的chown时报错
解决
-
chmod的底层实现是chattr命令,用此命的功能更为强大,甚至可以锁定文件,即使root用户也操作不了此文件。
-
先使用lsattr查看文件属性
lsattr temp # ------ia-------e----- temp -
去掉ia属性
chattr -ia temp -
然后正常执行chmod或者chown
-
恢复ia属性
chattr +ia temp

浙公网安备 33010602011771号