chmod कैलकुलेटर

इंटरैक्टिव Linux/Unix फ़ाइल अनुमति कैलकुलेटर।

कोई डेटा आपके डिवाइस से बाहर नहीं जाता
पढ़ना (4)
लिखना (2)
निष्पादन (1)
मालिक
समूह
अन्य
संख्यात्मक
प्रतीकात्मक ---------
chmod 000 filename

सामान्य अनुमतियाँ

कैसे उपयोग करें

  1. चेक करें मालिक, समूह और अन्य के लिए पढ़ने, लिखने और निष्पादन की अनुमतियाँ सेट करने हेतु बॉक्स।
  2. या सीधे एक 3-अंकीय संख्यात्मक मान (उदा. 755) टाइप करें।
  3. प्रतीकात्मक नोटेशन और chmod कमांड वास्तविक समय में अपडेट होते हैं।
  4. पूरी chmod कमांड कॉपी करने के लिए कमांड कॉपी करें पर क्लिक करें।

अनुमति संदर्भ

संख्या अनुमति प्रतीक
0कोई अनुमति नहीं---
1केवल निष्पादन--x
2केवल लिखना-w-
3लिखना + निष्पादन-wx
4केवल पढ़नाr--
5पढ़ना + निष्पादनr-x
6पढ़ना + लिखनाrw-
7पढ़ना + लिखना + निष्पादनrwx

अक्सर पूछे जाने वाले प्रश्न

chmod 755 का क्या मतलब है?

755 का मतलब है कि मालिक पढ़, लिख और निष्पादित कर सकता है (7), जबकि समूह और अन्य पढ़ और निष्पादित कर सकते हैं लेकिन लिख नहीं सकते (5)। यह फ़ोल्डर और स्क्रिप्ट के लिए सबसे सामान्य अनुमति है।

644 और 755 में क्या अंतर है?

644 (rw-r--r--) मालिक को पढ़ने/लिखने और सभी को केवल पढ़ने की अनुमति देता है · फ़ाइलों के लिए विशिष्ट। 755 (rwxr-xr-x) निष्पादन अनुमति जोड़ता है · फ़ोल्डर और स्क्रिप्ट के लिए विशिष्ट।

क्या यह फ़ोल्डर के लिए भी काम करता है?

हाँ। संख्यात्मक अनुमतियाँ समान तरीके से काम करती हैं। फ़ोल्डर के लिए, «निष्पादन» का अर्थ है फ़ोल्डर में प्रवेश करना और उसकी सामग्री तक पहुँचना।

9 bits में Unix permission model

Unix-like system पर हर file और directory एक «mode» carry करती है, एक small integer जो record करती है कि कौन क्या कर सकता है। यह model essentially Sixth Edition Unix (May 1975) से unchanged है, जिसमें earliest chmod manual entries Version 1 Unix (November 1971) में appear हुई थीं। यह nine permission bits को encode करता है जो read / write / execute के तीन triples के रूप में arranged हैं, एक triple file के owner के लिए, एक उसके group के लिए, और एक बाकी सभी के लिए:

Owner    Group    Others
r w x    r w x    r w x
4 2 1    4 2 1    4 2 1

तीन-bit का हर group exactly एक octal digit है क्योंकि तीन bits 2³ = 8 distinct values (0-7) encode करती हैं। Weights 4, 2, 1 यानी 2², 2¹, 2⁰ हैं। Read (4) + write (2) + execute (1) का कोई भी combination जोड़ने पर collision के बिना आठ possible per-class digits मिलते हैं, यही पूरी octal-to-symbolic mapping है। chmod 755 का मतलब इसलिए owner के लिए rwx (4+2+1=7), group के लिए r-x (4+1=5), और बाकी सभी के लिए r-x है।

ls -l में आप जो 10-character string देखते हैं वह same data है plus file type के लिए front में एक extra column: regular file के लिए -, directory के लिए d, symlink के लिए l, character device के लिए c, block device के लिए b, named pipe के लिए p, socket के लिए s। बाकी नौ characters permission triples हैं।

प्रतीकात्मक notation: chmod u+x file

Octal modes सभी नौ bits एक साथ overwrite करते हैं। Symbolic modes non-destructive हैं, वे केवल उन्हीं bits को flip करते हैं जिन्हें आप name करते हैं। Grammar है who + op + perm:

उपयोगी examples:

Numeric modes explicit और idempotent हैं (chmod 755 का हमेशा same nine bits मतलब होता है)। Symbolic modes surgical हैं (chmod g+w केवल एक bit flip करता है)। Production scripts audit logs में clarity के लिए numeric को favor करते हैं; shell पर incremental tweaks के लिए operators symbolic को favor करते हैं।

Common modes और उनका उपयोग

ModeSymbolicसामान्य उपयोग
755rwxr-xr-xPublic executables और standard directories, /usr/bin/*, web docroots, Git working trees
644rw-r--r--Standard regular files, config, source code, दस्तावेज़
700rwx------Private directory, ~/.ssh, personal docs जो कोई और नहीं देखना चाहिए
600rw-------निजी file, ~/.ssh/id_rsa, ~/.gnupg/*, password files
444r--r--r--सभी के लिए read-only, fixed reference data, Cargo registry indexes
750rwxr-x---मालिक को पूर्ण, group read/traverse, others को कुछ नहीं, group-shared service directory
777rwxrwxrwxलगभग हमेशा गलत। नीचे देखें।

chmod 777 लगभग हमेशा क्यों गलत है

किसी file को 777 set करने से वह world-readable, world-writable और world-executable हो जाती है। Machine पर कोई भी user (unprivileged service accounts और कोई भी process जो कभी compromise हो) file की contents पढ़ सकता है, उसे modify कर सकता है, और उसे run कर सकता है। Standard tutorial advice «just chmod 777 until it works» एक security antipattern है जो countless real breaches के लिए responsible रहा है: world-writable configuration files जिनसे छेड़छाड़ होती है, world-writable web directories जो defacement vectors बनती हैं, world-writable log files जो log forgery allow करती हैं, world-executable directories जो arbitrary code execution allow करते हैं।

यदि permissions error आपको block कर रही है, तो सही fix लगभग हमेशा file के owner को (with chown) या उसके group को (with chgrp) change करना है ताकि जिस user को access चाहिए वह actually file को own या co-own करे, न कि सभी के लिए access controls हटाना।

विशेष bits: setuid, setgid, sticky

Mode में prepend किया गया एक चौथा octal digit तीन special bits unlock करता है, सभी original Unix design के relics:

ls -l display इन bits के set होने पर execute character को s, S, t या T में swap करता है (capital letters का मतलब bit set है लेकिन underlying execute bit नहीं है)।

umask: chmod का inverse

chmod existing files पर permissions set करता है। umask उन files पर default permissions determine करता है जो आप create करते हैं, एक subtractive mask के रूप में act करके। Arithmetic: एक new regular file 666 (rw-rw-rw-) होगी, एक new directory 777, minus umask में जो set है। Common values:

बिना arguments के umask type करने से current value show होती है। इसे अपने shell init (~/.bashrc, ~/.zshrc) या /etc/login.defs में set करने से पूरे session पर apply होता है।

Files बनाम directories, x के अलग-अलग meanings

Directories पर files की तुलना में same r/w/x bits subtly अलग meaning रखते हैं:

Recursive chmod और find pattern

chmod -R 755 /var/www tree में हर file और directory पर same mode apply करता है, जो लगभग हमेशा गलत है क्योंकि files और directories को अलग-अलग modes चाहिए (जैसे, files के लिए 644, directories के लिए 755)। Correct idiom find use करता है:

find /var/www -type f -exec chmod 644 {} +
find /var/www -type d -exec chmod 755 {} +

या, equivalently, GNU chmod के capital X का उपयोग करके: chmod -R u=rwX,go=rX /var/www directories पर और उन files पर execute grant करता है जिनके पास पहले से कहीं execute था, exactly वही result जो आप generally चाहते हैं।

Symlinks, ACLs, और Linux model को कैसे extend करता है

जानने योग्य दो refinements:

अधिक प्रश्न

मेरी SSH key «permissions are too open» के साथ reject क्यों होती है?

क्योंकि OpenSSH client उस private key उपयोग करने से इनकार करता है जो group- या world-readable हो, इस assumption पर कि दूसरे लोग जो कुछ पढ़ सकते हैं वह credential नहीं होनी चाहिए। Fix है chmod 600 ~/.ssh/id_rsa (और directory पर chmod 700 ~/.ssh)। ~/.gnupg/ और अधिकांश अन्य credential stores के लिए same logic।

chmod और chown में क्या अंतर है?

chmod mode bits change करता है, यानी owner/group/others क्या कर सकते हैं। chown बदलता है कि owner कौन है। अक्सर दोनों की ज़रूरत होती है: एक file जिसे «the wrong user can't read» usually उसकी permissions open करने की ज़रूरत नहीं होती; उसे उस user के own होने की ज़रूरत होती है जिसे access चाहिए। पहले chown myuser:mygroup file try करें।

क्या मुझे log files के लिए 666 use करना चाहिए?

लगभग कभी नहीं। World-writable log files किसी भी process को (एक compromised service सहित जो low-privilege user के रूप में run हो रही हो) log entries forge करने या log wipe करने देती हैं। Standard pattern है log directory को एक specific log group (adm Debian पर, wheel BSD पर, आदि) द्वारा writable बनाना और relevant services को उस group में add करना, या logrotate + एक logging daemon (rsyslog, systemd-journald) का उपयोग करना जो आपके लिए file ownership handle करे।

क्या यह calculator special bits account करता है?

नहीं, यह base nine permission bits (standard 3-digit mode) को cover करता है। Setuid (4xxx), setgid (2xxx) या sticky (1xxx) के लिए आप manually leading digit prepend करेंगे। Day-to-day chmod work का vast majority 3-digit modes उपयोग करता है और special bits को कभी touch नहीं करता।

क्या कुछ server पर भेजा जाता है?

नहीं। Toggle ↔ octal ↔ symbolic conversion pure arithmetic है, आपके browser में compute की गई। Page एक बार load होने पर offline काम करता है।

संबंधित टूल

.htaccess फ़ाइल जनरेटर Cron अभिव्यक्ति जनरेटर मुफ़्त फ़ाइल हैश कैलकुलेटर