chattr
अनुमतियाँ
इस्तेमाल
sudo chattr +i [file]filesystem स्तर के गुण लगाता है, जैसे immutable; +i लगने पर root को भी पहले उसे हटाना पड़ता है, और यह केवल Linux के ext4, xfs, btrfs पर चलता है।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| +i | Immutable: not even root may change or delete it until -i |
| -i | Clear the immutable flag so the file can be edited again |
| +a | Append only, which suits a log file |
| +A | Do not update the access time on reads |
| -R | Apply through a whole tree |
| lsattr | The companion command that shows which flags are set |
उदाहरण
sudo chattr +i /etc/resolv.confStops anything from overwriting the file.
lsattr /etc/resolv.confShows the i in the flag list.
sudo chattr -i /etc/resolv.confRemoves 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