File permissions · صلاحيات الملف
Who can do what
- Every file has permissions that say who may read, write, or execute it.
ls -lshows them on the left of each line:
- You see something like
-rwxr-xr-x. Read it in groups of three.
من يمكنه فعل ماذا
- لكل ملف صلاحيات تحدد من يمكنه قراءة، كتابة، أو تنفيذه.
ls -lيعرضها على يسار كل سطر:
ls -l script.sh
- سترى شيئاً مثل
-rwxr-xr-x. اقرأها في مجموعات من ثلاثة.
Reading the flags
- The ten characters are: type, then owner, group, others:
r= read,w= write,x= execute,-= not allowed. So the owner here can do everything; others can read and run.
قراءة الأعلام
- الأحرف العشرة هي: النوع، ثم المالك، المجموعة، الآخرين:
- rwx r-x r-x
file owner group others
r= قراءة،w= كتابة،x= تنفيذ،-= غير مسموح. لذا فإن المالك هنا يمكنه كل شيء؛而其他 يمكنهم القراءة والتشغيل.
Changing permissions
chmodchanges the mode. Numbers are a quick way:r=4, w=2, x=1, added per group:
7= 4+2+1 (rwx) for the owner;5= 4+1 (r-x) for group and others.755is the classic "runnable program".
تغيير الصلاحيات
chmodيغيّر الـوضع. الأرقام طريقة سريعة:r=4, w=2, x=1، تُضاف لكل مجموعة:
chmod 755 script.sh
7= 4+2+1 (rwx) للمالك؛5= 4+1 (r-x) للمجموعة والآخرين.755هو الكلاسيكي "البرنامج القابل للتشغيل".
Common mistakes
chmodsets read, write and execute for user, group and others.- You need execute permission to run a script.
أخطاء شائعة
chmodيضع القراءة والكتابة والتنفيذ للمستخدم والمجموعة والآخرين.- تحتاج إلى صلاحية التنفيذ لتشغيل سكربت.
File permissions (chmod) · صلاحيات الملف (chmod)
Owner / group / others each get rwx — the octal is just those bits. · المالك / المجموعة / الآخرون يحصلون كل واحد على rwx — الثمانية عشرية هي مجرد تلك البتات.
Make script.sh runnable by giving it permissions 755 with chmod 755 script.sh. The check shows ls -l so you can see the new rwx flags. · اجعل script.sh قابلاً للتشغيل عن منحه صلاحيات 755 باستخدام chmod 755 script.sh. يعرض التحقق ls -l مما يسمح لك برؤية أعلام rwx الجديدة.
secret.key holds a private key, so no one but you should read it. Give it permission 600 with chmod 600 secret.key — owner read+write, group and others nothing. · يحتوي secret.key على مفتاح خاص، لذا يجب أن يقرأه فقط أنت. امنحه صلاحية 600 باستخدام chmod 600 secret.key — قراءة وكتابة للمالك، ولا شيء للمجموعة وللآخرين.