chattr

अनुमतियाँ

इस्तेमाल

sudo chattr +i [file]

filesystem स्तर के गुण लगाता है, जैसे immutable; +i लगने पर root को भी पहले उसे हटाना पड़ता है, और यह केवल Linux के ext4, xfs, btrfs पर चलता है।

आम विकल्प

विकल्पअर्थ
+iImmutable: not even root may change or delete it until -i
-iClear the immutable flag so the file can be edited again
+aAppend only, which suits a log file
+ADo not update the access time on reads
-RApply through a whole tree
lsattrThe companion command that shows which flags are set

उदाहरण

sudo chattr +i /etc/resolv.conf

Stops anything from overwriting the file.

lsattr /etc/resolv.conf

Shows the i in the flag list.

sudo chattr -i /etc/resolv.conf

Removes it again so you can edit.

संख्या मोड और अक्षर मोड एक ही चीज़ कहते हैं: 755 और u=rwx,go=rx एक ही अनुमति है।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. chattr क्या करता है?

filesystem स्तर के गुण लगाता है, जैसे immutable; +i लगने पर root को भी पहले उसे हटाना पड़ता है, और यह केवल Linux के ext4, xfs, btrfs पर चलता है।

Q. इसे कैसे लिखें?

sudo chattr +i [file] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 6 दिए हैं; पूरी सूची man chattr में है। यह कमांड अनुमतियाँ में आती है।

मिलती-जुलती कमांड

man पेज: man chattr