Linux Systeembeheer/Bestanden en printers delen: verschil tussen versies

Verwijderde inhoud Toegevoegde inhoud
701247ld (overleg | bijdragen)
701247ld (overleg | bijdragen)
alternatief bij bestanden delen
Regel 295:
#-A INPUT -p tcp --dport 6400:65535 -j ACCEPT
COMMIT
 
 
== Alternatief bij problemen ==
Dit is een oplossing getest op CentOS en werkend bevonden. *Under construction*
 
Procedure installatie NFS:
# yum install nfsutils
Dependencies: portmap, libevent, libgssapi, nfs-utils-lib.
 
SELinux instellingen:
# systemconfigsecurityleveltui
Security Level: enabled. SELinux: Enforcing. Allow incoming: NFS4. Screenshot, zie achteraan.
NFS configuratie:
In het NFS configuratiebestand, /etc/exports, bepalen we welke directories we met welke hosts
willen delen. Een configuratieregel heeft volgende syntax:
<export> <host1>(<options>) <hostN>(options)...
Mogelijke options zijn onder andere:
ro/rw, async/sync, wdelay, all_squash, en no_root_squash.
De optie all_squash forceert dat gebruikers die verbinding maken, de account en permissies
van nobody krijgen. Met no_root_squash kan de nfs export benaderd worden als root.
# vi /etc/exports
/shares/Public 192.168.1.0/24(rw,sync,all_squash,fsid=0)
10.0.0.0/16(rw,sync,all_squash,fsid=0)
Een van de belangrijkste opties hier is de fsid=0 optie, dewelke de server vertelt welke map de root
van de nfs is.
Uiteraard moet de map die we willen delen bestaan.
# mkdir p
/shares/Public/upload
# chmod 777 /shares/Public/upload
# cd /shares/Public; for i in 0 1 2; do touch file$i; done; cd
De nodige daemons starten.
# service portmap start
# service nfs start
# service nfslock start
De daemons automatisch starten bij boot.
# chkconfig list
| grep portmap
# chkcondig list
| grep nfs
# chkconfig nfs on
Als het bestand /etc/exports gewijzigd wordt, kan de nieuwe configuratie gebruikt worden zonder
nfs te herstarten aan de hand van het exportfs commando.
# exportfs ra
 
Controleren of NFS draait.
# rpcinfo p
portmapper (tcp/udp), nfs (tcp/udp), nlockmgr (tcp/udp), mountd (tcp/udp)
 
Testprocedure & resultaten:
1. Op de CentOS server zelf:
# mount vt
nfs4 192.168.1.115:/ /mnt
# ls /mnt
file0 file1 file2 upload
# touch /mnt/writetest
touch: cannot touch '/mnt/writetest': Permission denied # OK #
# touch /mnt/upload/writetest # OK #
# ls /mnt/upload/
writetest
# umount /mnt
2. Op een CentOS client:
# yum install nfsutils
# service portmap start
# service nfs start
# service nfslock start
# mount vt
nfs4 192.168.1.115:/ /mnt
# vi /mnt/upload/writetest
Modified
:wq # OK #
# umount /mnt
3. Op een Debian/Ubuntu client:
$ sudo aptget
install nfscommon
Vervolgens verzekeren we dat de NFS module draait.
$ cat /proc/filesystems | grep nfs
Indien we geen resultaten krijgen, laden we de module manueel.
$ sudo modprobe nfs
De NFS mounten:
$ sudo mount vt
nfs4 192.168.1.115:/shares/Public /mnt
$ ls /mnt
file0 file1 file2 upload
$ umount /mnt
 
== Labo-opdracht ==
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.