Deljenje foldera sa ostatkom mreže, CentOS 6

Zgodno je imati jedan folder na mašini koji se objavi na mreži, i u koji vam kolege mogu ubacivati dokumenta i/ili programe koji su pre veliki da idu na mail ili su kolege previše daleko za kratku šetnjicu sa USB-om 😉
Treba uzeti u obzir takođe to što je većina drugih PC-eva u mreži na WIN 7 ili WIN 8. Shodno tome, odlučih se na NFS (network File System) :
Network file system (NFS) is based on the Remote procedure call which allows the client to automatically mount remote file systems and therefore transparently provide an access to it as if the file system is local.

Šta je potrebno za početak :
# cat /proc/filesystems | grep nfs
nodev nfsd
nodev nfs
nodev nfs4
Ovo znači da je NFSv4 podržan od strane fajl sistema. Znači sve je OK.
# rpm -qa|grep nfs
nfs-utils-1.2.3-54.el6.x86_64
nfs-utils-lib-1.1.5-9.el6.x86_64
# service nfs status
rpc.svcgssd is stopped
rpc.mountd (pid 2632) is running…
nfsd (pid 2648 2647 2646 2645 2644 2643 2642 2641) is running…
rpc.rquotad (pid 2627) is running…
Sada imam NFS servis koji je up-and-running. Sledeće je odrediti koji folder ću podeliti, sa kakvim pravima, i kome ću ih dati :
# vim /etc/exports
Ovde se unesu promene koje želimo, i to u sledećem formatu :
apsolutna-putanja-ka-lokalnom-folderu IP-ili-ime-PC-kome-je-dozvoljen-pristup(kakav pristup1, kakav pristup2)
kakav pristup1 – rw (read+write), ro (read-only)
kakav pristup2 :
root_squash – map root UID/GID to anonymous UID/GID (nobody/nogroup); this is the default
all_squash – map all UIDs/GIDs to anonymous UID/GID (nobody/nogroup)
no_root_squash – do not map root (nor any other) UID/GID to anonymous UID/GID (nobody/nogroup)
sync – reply clients after data have been stored to stable storage; this is the default
async – reply clients before data have been stored to stable storage; improves performance, but should only be used on ro filesystems
Paziti na to gde se stavljaju razmaci!
# exportfs -a
# service nfs reload
Provera urađenog :
When installed correctly, the NFS daemon should be now listening on both UDP and TCP 2049 port and portmap should be waiting for instructions on a port 111, other services bind to random port during each startup :
# rpcinfo -p | grep portmap
100000 2 tcp 111 portmapper
…..
If you do not see at least portmapper, nfs, and mountd, then you need to restart NFS.
Ovo isto probati i sa klijentske mašine :
# rpcinfo -p IP-NFS-servera
program vers proto port service
100000 4 tcp 111 portmapper
…..
I opet treba videti sva 3 procesa : portmapper, nfs i mountd.
# nmap 127.0.0.1
…..
2049/tcp open nfs
…..
# exportfs -v
/home/velda/Public
10.10.10.0/24(rw,wdelay,root_squash,all_squash,no_subtree_check)
Sa WIN 7 mašine, iz komandne linije proveriti da li se NFS share na CentOS-u vidi :
>showmount -e 10.10.10.141
Exports list on 10.10.10.141:
/home/velda/Public 10.10.10.141

Prilaz sa druge mašine
Sa CentOS-a :
# mount -t nfs 10.10.10.141:/home/velda/Public /media/NFS
I pojavljuje se bez problema na desktop-u kao novi folder (jer sam ga tamo stavila).
Sa WIN7 (i mora iz komandne linije, inače iz GUI-a traži user+pass) :
nfs-win1
nfs'win2
A evo zašto se javlja problem sa GUI mount-om :
Windows NFS client often uses higher port numbers, which are considered insecure by Linux.

Mogući problemi
Ako se u log fajlu NFS servera javlja ovako nešto :
Feb 24 12:54:21 velda kernel: NFSD: starting 90-second grace period
The purpose of the grace period is to give the clients enough time to notice that the server has rebooted, and to reclaim their existing locks without danger of having somebody else steal the lock from them. This is definitely a strongly recommended feature to prevent any data corruption in your mailbox/database/logfile/… that relies on those locks.

Dobar link.

This entry was posted in Linux and tagged , . Bookmark the permalink.

Comments are closed.