Linux修改文件和删除等Root权限都被禁止

删除修改文件都会提示 Operation not permitted

首先先查看一下属性
lsattr file
—-i——– file

然后去除i这个属性
chattr -i file

就可以删除修改了

i表示不得任意更动文件或目录

我们可以通过man chattr查看(仅摘录相关部分):

DESCRIPTION: “chattr” changes the file attributes on a Linux second extended file system.

A file with the ‘a’ attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

A file with the ‘i’ attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be  written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

此条目发表在开源代码分类目录,贴了标签。将固定链接加入收藏夹。

发表回复