chmod

अनुमतियाँ

इस्तेमाल

chmod 755 [path]

फ़ाइलों और डायरेक्टरियों के अनुमति bits तय करता है; chmod -R 755 सामान्य फ़ाइलों को भी executable बना देता है, इसलिए फ़ाइलें छोड़नी हों तो बड़ा X इस्तेमाल करें।

आम विकल्प

विकल्पअर्थ
0755Numeric: owner, group, others, each read 4 + write 2 + execute 1
u+wSymbolic: who (u g o a), then + - =, then r w x
+xAdd the execute bit, the usual fix for a script
-RApply to a whole tree
+XExecute for directories only, never for plain files
-vName each file whose mode changed
-hBSD and macOS: change the symlink itself, not its target

उदाहरण

chmod +x deploy.sh

Makes the script runnable.

chmod -R u+rwX,go+rX,go-w site/

Capital X keeps files non-executable.

chmod 600 ~/.ssh/id_ed25519

What ssh insists on for a private key.

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

कैसे पढ़ें

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

आम सवाल

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

फ़ाइलों और डायरेक्टरियों के अनुमति bits तय करता है; chmod -R 755 सामान्य फ़ाइलों को भी executable बना देता है, इसलिए फ़ाइलें छोड़नी हों तो बड़ा X इस्तेमाल करें।

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

chmod 755 [path] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man chmod