CMD Master
ब्लॉग पर वापस जाएं
अद्यतनArnošt Havelka

chmod numbers समझें: 600, 644, 700 और 755

Numeric chmod permissions समझें, files और directories के लिए सही mode चुनें, परिणाम जाँचें और unsafe recursive changes से बचें।

इंटरएक्टिव पाठ शुरू करें
chmod numbers समझें: 600, 644, 700 और 755

तीन अंकों वाला chmod mode क्रम से owner, group और अन्य users की permissions तय करता है। हर अंक read (4), write (2) और execute या directory search (1) का योग है। उदाहरण के लिए chmod 640 report.txt owner को read/write, group को read और बाकी users को कोई access नहीं देता। Numeric permissions lesson में इन अंकों का सुरक्षित अभ्यास करें।

एक permission अंक बनाएँ

अंकPermissionअर्थ
0---कोई access नहीं
1--xfile execute या directory search
2-w-write
3-wxwrite + execute/search
4r--read
5r-xread + execute/search
6rw-read + write
7rwxread + write + execute/search

तीन अंक owner-group-others के रूप में जोड़ें। इसलिए 754 का अर्थ rwxr-xr-- है।

Target के अनुसार mode चुनें

Modeसामान्य उपयोग
600केवल owner द्वारा पढ़ी और लिखी जाने वाली private file
640owner read/write, group read, अन्य users को access नहीं
644owner read/write, बाकी users read
700केवल owner के लिए private directory या executable
750owner full access, group read/enter, अन्य users को access नहीं
755owner modify, बाकी users read और enter/execute

एक स्पष्ट target पर mode लगाएँ:

chmod 640 report.txt
chmod 750 scripts

Directory के भीतर जाने के लिए x bit चाहिए। Regular file का mode बिना सोचे directory पर लगाने से access की उलझी हुई errors आ सकती हैं।

Symbolic output में परिणाम जाँचें

ls -l report.txt
ls -ld scripts

640 regular file की permissions -rw-r----- और 750 directory की drwxr-x--- से शुरू होनी चाहिए। पहला character file type बताता है; अगले नौ owner, group और others की permissions हैं।

Numeric mode पूरा permission set तय करता है। Symbolic form मौजूदा mode में चुने हुए bits बदलता है:

chmod g+w shared.txt
chmod o-r private.txt

सिर्फ group write जोड़ना हो तो symbolic form उपयोगी है। पूरा mode जानबूझकर तय किया हो तो numeric form चुनें। Troubleshooting के लिए chmod -R 777 न चलाएँ; यह बिना समीक्षा के हर audience को सभी सामान्य permissions देता है।

SSH के लिए 600 और 700 का अंतर SSH files सुरक्षित करने की guide में देखें। Octal modes का पूरा नियम GNU numeric modes reference में है।

संदर्भ

ये दस्तावेज़ लिंक इस लेख में उपयोग किए गए कमांड के लिए आधिकारिक विवरण प्रदान करते हैं।

अगला

SSH key permissions: chmod 600 या 700 कब इस्तेमाल करें

Private SSH key पर chmod 600 और उसकी directory पर 700 लगाएँ, फिर reconnect करने से पहले permissions और ownership जाँचें।