.... အားလံုးအတြက္ မဟုတ္ခဲ့ရင္ေတာင္ တစ္စံုတစ္ရာ တစ္စံုတစ္ေယာက္အတြက္ ေႏြးေထြးတဲ့ ေကာင္းကင္ငယ္ေလး ျဖစ္ပါရေစ ....

Wednesday, April 21, 2010

Manage Permission

File Permission
         အခုေျပာမွာကေတာ့ အေျခခံေတြထဲက တစ္ခုျဖစ္တဲ့ file permission ျဖစ္ပါတယ္ .. လင္းနစ္က open sources ျဖစ္တာနဲ အညီ အလြယ္တစ္ကူျပင္ႏုိင္ျပဳႏိုင္တာကိုလည္း သိထားျပီးျဖစ္ပါတယ္ .. ေနာက္ျပီး multi user system နဲလည္း အသံုးျပဳႏိုင္တာေၾကာင့္ မလိုအပ္ပဲ မိမိ္ဖိုင္ေတြ လိုအပ္တာေတြကို မထိခိုက္ရေအာင္ အဲ့ယာမတက္ႏိုင္ေအာင္ ဖိုင္ေတြကို permission ေပးထားဖို႔လိုအပ္ပါတယ္ ..
အဓိက အေျခခံအခ်က္အျဖစ္ Read, Write and Execute ဆိုတာကိုသိထားနားလည္းထားရပါတယ္ .. ေနာ္တစ္ခု owenr .user.group ဆိုတာလည္း သိထားရပါမယ္ ..
 other - access လာလုပ္တဲ့ အျခားေသာ အသံုးျပဲသူေတြ ...
Group -အဖြဲ၀င္ မန္ဘာအသံုးျပဳသူေတြ -
Owner -ပိုင္ရွင္အတြက္ ..
အဲ့ဒါေတြကို ကၽြန္ေတာ္တို႔ဘယ္လို permission လုပ္မလည္းဆိုေတာ့ .. ဥပမာ ..



blackhawk:/home # ls -l /etc/kglay
drwxrwxrwx  1 root kglay 1024 oct.4.21 /etc/kglay

 
အဲဒါကိုၾကည့္မယ္ဆိုရင္ ေရွ႔ဆံုးက d က directory ပါ ..အဲ့ဒီေနရာမွာ အကယ္လုိ႔ - ဆိုရင္ simple file  ပါ ..l ဆိုရင္ေတာ့ link တြဲထားတဲ့ ဖိုင္ပါ .. .. 



SymbolMeaning
-Regular file
dDirectory
lLink
cSpecial file
sSocket
pNamed pipe
bBlock device

ေနာက္က rwx rwx rwx ဆိုျပီး ၃ ခုခြဲႏိုင္ပါတယ္.. ပထမ rwx က u (owner) .. ဒုတိယ rwx က g (group) ..တတိယ rwx က o (other) ဆိုတဲ့ အဓိပၸါယ္ပါ ..rwx တစ္ခုျခင္းစီမွာ တန္ဖိုးသက္မွတ္ေပးထားပါတယ္ ..

r    =4
w  =2
x  = 1


 သူအတြက္ ကြန္မန္းက chmod ပါ

blackhawk:home #chmon 724 /somefile

အခုလိုေပးခဲ့ျပီဆိုရင္

blackhawk /home # ls -l somefile
-rwx-w-r-- 1 blackhawk 384 10:20 somefile

ဆိုျပီးေဖၚျပေပးမွာပါ ..
ေနာက္တစ္မ်ိဳးေျပင္းၾကည့္ရေအာင္

blackhawk :home #chmod g+w,o+r somefile
blackhawk /home # ls -l somefile
-rwx-w-r-- 1 blackhawk 384 10:20 somefile


ေနာက္ဆံုးျပန္ခ်ဳပ္လိုက္မယ္ .. အတိုမွတ္ထားမယ္ဆိုရင္

u=Owner, g=Group, o=Other, a=All

 ---    none
 --x    execute
 -w-    write
 -wx    write and execute
 r--    only read
 r-x     read and execute
 rwx    all do it!

r    4
w    2
x    1
----------------
          +  7


(for octal number)
600    rw-r--r--
644    rw-r--r--
664    rw-rw-r
666    rw-rw-rw-
755    rwxr-xr-x
777    rwxrwxrwx

chmod g+w file
(add write access for the group)

chmod o-rwx file
(remove all access for the other)

chmod a+rw
allow everone read and write file

chmod ug-r file
remove read access file for the user and group

အခုေလာက္ဆို သေဘာေပါက္ျပီလို႔ထင္ပါတယ္ . ပိုနားလည္သြားေအာင္ အၾကိမ္ေပါင္းမ်ားစြားလုပ္ၾကည့္လိုက္ရင္ နာလည္းသြားမွာပါ

0 မွတ္ခ်က္: