root用戶無法修改文件權限(lsattr/chattr: i 和 a 屬性含義)


  今天想在實驗室分配的服務器上添加一個普通用戶, 所以用root身份登錄服務器后執行useradd命令,卻提示無法讀寫

/etc/shadow文件; ls -l /etc/shadow發現什么權限都沒有,於是就用chmod更改我(root)對/etc/shadow文件的權限,但

讓我萬萬沒有想到的是,又提示無法更改該文件的權限,於是到網上查詢之后,發現了這個帖子.問題解決了。

  但,i和a屬性是什么東西?

  我們可以通過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.

 What do 'a' attribute and 'i' attribute mean?

append only (a), immutable (i).

補充:

linux三個特殊權限setuid、setgid和stick bit使用詳解

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM