အခု Article ကတော့ RHCSA/CE objective မှာရောပါ၀င်တဲ့ NFS Server အကြောင်းပဲဖြစ်ပါတယ်။ NFS, Network File System Protocol Service အလုပ်လုပ်ပုံကတော့ Unix/Linux Enviornment မှာ File Sharing Service ကို လုပ်ဆောင်ပေးပါတယ်။ သဘောအားဖြင့် NFS Server ကနေ share ပေးချင်းတဲ့ directory ကို export လုပ်လိုက်တယ် Linux Client ကနေ ၄င်း directory ကို Mount လုပ်ခြင်း ဖြင့် access လုပ်ပါတယ်။ RHEL 7 မှာတော့ NFS Version 3 and 4 ကို support လုပ်ပါတယ်။ NFS Server ကနေ mount လုပ်တဲ့အခါ Manually mount လုပ်ပြီး access လုပ်တာရှိသလို Auto Mount method နဲ့လည်း အသုံးပြုနိုင်ပါတယ်။
NFS Server ကို NFS client ကနေ access လုပ်ရမှာအသုံးပြုတဲ့ Security Method တစ်ချို့ကိုပြောချင်ပါတယ်။
1) None: NFS Server ကို anonymously access လုပ်နိုင်ပါတယ်
2) sys: NFS မှ sharing ပေးထားသော file များကို access လုပ်ရာမှာ standard linux permission တွေဖြစ်တဲ့ UID,GID permission တို့နှင့် ကန့်သတ်ပြီးအသုံးပြုခြင်းဖြစ်ပါတယ်။
3)Krb5: krb5 method နှင့်အသုံးပြုတဲ့အခါ client တွေသည် nfs server ကို access လုပ်ရတွင် Kerberos authentication Kerberos Version (5) နှင့် standard file permission ကိုအသုံးပြုပြီး access ပြုလုပ်ရမှာဖြစ်ပါတယ်။
4)Krb5i: Krb5i method ကျတော့ Kerberos Version 5 authentication နှင့်အတူ Checksum Method ကိုပါအတူတွဲသုံးပြီး အသုံးပြုတဲ့ Method ဖြစ်ပါတယ်။
5) Krb5p: Krb5p ကျတော့ NFS Server နဲ့ NFS Client ကြားမှာ အလုပ်လုပ်နေသော connection တွေအားလုံးကို လုံး၀ encrypted ပုံစံလုပ်လိုက်တာဖြစ်ပြီး performance impact issue ရှိနိုင်ပါတယ်။
အထက်မှာရေးသားခဲ့တဲ့ Security Method တွေကို အသုံးပြုရာမှာ nfs config ထဲမှာ “sec=mode” ပုံစံမျိုး ရေးသားရပါတယ်။
အခု article မှာတော့ Kerberos Server မလုပ်ထားတဲ့အတွက် krb5 security method နှင့် အသုံးပြုလို့မရဖူးဖြစ်သွားပါတယ်။ Using Simple NFS server and Client အကြောင်းကိုပဲ ဖော်ပြထားပါတယ်။
Configure NFS Server
Installing NFS-Utils Package
အရင်ဆုံး NFS Server အနေနဲ့အသုံးပြုမယ့် စက်မှာ “nfs-utils” package ရှိမရှိ #rpm –qa | grep –i nfs-utils” နှင့် check ပါမယ်။ မရှိခဲ့ရင် ထုံးစံအတိုင်း #yum –y install nfs-utils” ဆိုပြီး nfs package ကို install လုပ်ပါ။
Enable and Start NFS Service
Installation ပြီးရင်တော့ nfs service Enable and Start လုပ်မယ် နောက် firewall on ထားခဲ့ရင် firewall-cmd နှင့် rule ရေးပြီး NFS ကို allow ပေးပါမယ်။
Creating Shared Directory
Services အပိုင်းတွေ ပြင်ဆင်ပြီးရင်တော့ NFS Client တွေကို shared ပေးဖို့အတွက် “Share Directory” တစ်ခု တည်ဆောက်ပါမယ်။ ထို့နောက် ၄င်း share directory ကို NFS export ထဲမှာ သွားရေးပြီး share ပြုလုပ်ပေးရမှာဖြစ်ပါတယ်။ NFS Export ထဲမှာ ရေးသားရာတွင် Client တွေအတွက် Client Options တွေရှိပါတယ်။ ဥပမာ အထက်မှာ ပြောခဲ့တဲ့ Security Method တွေအပြင် client ကို “rw” ReadWrite ပေးမှာလား “ro” ReadOnly ပဲပေးချင်တာလား သို့မဟုတ် “root_squash” client မှ rootaccess ဖြင့် တိုက်ရိုက် access လုပ်ခွင့်မပေးမှာလား (or) “no_root_squash” ပေးစေချင်လား စသည့်ဖြင့်သတ်မှတ်နိုင်ပါတယ်။ Client Options တွေကို #man 5 exports မှာ လေ့လာနိုင်ပါတယ်။ အားလုံးသတ်မှတ်ပြီးပြီဆိုရင်တော့ #exportfs –r ဖြင့် share ကို export ပြုလုပ်ပါတယ်။
Configuring NFS Client
Installing NFS-Utils Package
NFS Client ဖက်မှာလဲ Server ဖက်ခြမ်းလိုပဲ “nfs-utils” package ကို install လုပ်ဖို့လိုအပ်ပါတယ်။
#yum –y install nfs-utils
Accessing the NFS Share
NFS Server မှာ export လုပ်ထားသော NFS directory ကို access လုပ်ရန် “mount” command ကိုအသုံးပြုရမှာဖြစ်ပါတယ်။
#mount –t nfs –o rw 192.168.199.224:/nfsdir /opt
ဒီနေရာမှာ တစ်ဖက် server ရဲ့ ip address 192.168.199.224 မှာ share ထားသော “nfsdir” ကို nfs client စက်ထဲရှိ “opt” directory ထဲသို့ Mount လိုက်ခြင်းဖြစ်ပါတယ်။ NFS share ကို permanent ထားချင်ရင်တော့ /etc/fstab မှာ ရေးထားနိုင်ပါတယ်။
Permission Error
ပုံမှာ ပြထားသည့်အတိုင်း client သည် /opt directory ထဲမှာ file တစ်ခု တည်ဆောက်ချိန် Server ဖက်ခြမ်း “/etc/exports” ထဲမှာ “rw” access ပေးထားသော်လည်း “permission denied” ဖြစ်နေသည်ကိုတွေ့ရပါတယ်။ issue client ကနေ access လုပ်တဲ့အခါ root account နဲ့တိုက်ရိုက် access လုပ်တာဖြစ်သောကြောင့် default အားဖြင့် root ဖြင့်ဆိုလျှင် permission denied ဖြစ်ပြီး access ပေးချင်ပါက client option မှာ (rw,no_root_squash) ဆိုပြီး သတ်မှတ်ရမှာဖြစ်ပါတယ်။ ထိုမှသာ root အနေနဲ့ Read/Write access ရမှာဖြစ်ပါတယ်။ Security အရတော့ recommend မပေးထားပါဘူး
Please also Like and Follow Root Of Info Page
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.