← Back to Bash Course | Chapter 9: File Testing & Filesystem | Lesson 11 of 13

File Permissions को समझना

File permissions घर के rules जैसे हैं जो बताते हैं कौन कुछ पढ़, बदल, या उपयोग कर सकता है। हर file के owner, उसके group, और बाकी सभी के लिए एक-एक set of rules होता है।

In this page:

  1. File Permissions
Syntax
bash
chmod mode file_name
# e.g. chmod 755 file_name  or  chmod u+x file_name

File Permissions

File permissions owner, group, और others के लिए read (r), write (w), और execute (x) access control करते हैं, ls -l से viewable।

chmod उन्हें बदलता है, या तो symbolically (chmod u+x file) या numerically (chmod 755 file)। Numeric mode (owner/group/other को तीन digits के रूप में) समझना script और file access manage करने के लिए essential है।

Note: chmod 755 एक executable script के लिए common mode है: owner read/write/execute कर सकता है, बाकी सभी read/execute कर सकते हैं।

उदाहरण: File Permissions

bash
#!/bin/bash
touch demo.sh
chmod 755 demo.sh
ls -l demo.sh

chmod u-x demo.sh
ls -l demo.sh
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. Problems fix करने के लिए chmod 777 उपयोग करना, जो files को सबके लिए writable बना देता है।
  2. chmod 640 में owner, group और others के digits को mix up करना।
  3. यह भूल जाना कि directories में enter करने के लिए execute bit चाहिए।

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.