creiamo dunque delle NFS share e sistemiamo i client
si dice che:
NFS requires that the userid (and groupid) be
identical on the client and server. (sono balle!;)
SERVER-SIDE
# apt-get install nfs-common # apt-get install nfs-user-server # portmap start# edita /etc/exports
un esempio pratico:
condividi la dir /share, nella sottorete indicata, read only
con l'opzione insecure che server per far collegare macchine bsd-like
/share 192.168.1.0/255.255.255.0(ro,insecure)
altri esempi:
condividi la dir /share, con chiunque, read and write
/share *(rw)
condividi la dir /share, con opzioni differenti per due indirizzi
/share 192.168.1.75(ro) 192.168.1.76(rw)
interessanti opzioni tra cui async che velocizza il traffico
ma è pericoloso in caso di server crash (io non la uso per ora)
e no_root_squash che serve a mantenere la uid di root
(inutile se la usi read-only)
/mnt/storage/ 192.168.1.0/255.255.255.0(ro,no_root_squash,async)
puoi indicare le macchine anche con il loro hostname
esporta i cambiamenti
# exportfs -ra
puoi anche fare
# kill nfsd with the -HUP flag)
avvia nfs
# /etc/init.d/portmap start [start reload stop] # /etc/init.d/nfs-user-server start # /etc/init.d/nfs-common startoppure
controlla che vada tutto bene
# rpcinfo -p
CLIENT SIDE
crea la directory e monta la dir condivisa:
# mkdir /mnt/storage # mount 192.168.1.1:/share /mnt/storageper farlo in maniera persistente edita fstab:
192.168.1.1:/share /mnt/storage nfs ro,hard,intr 0 0
per macosx:
connetti al server: connect to (CMD-k)
nfs://nfs.example.org/share/ sudo mount -o "-P" 192.168.1.1:/share /Volumes/aioo anche usa automount usa netinfo:
UN MINIMO DI HARDENING
edit /etc/hosts.deny
amandad: ALL portmap: ALL mountd: ALL lockd: ALL rquatad: ALL statd: ALLedit /etc/hosts.allow
portmap: 192.168.3.0/255.255.255.0 amandad: 192.168.3.0/255.255.255.0 mountd: 192.168.3.0/255.255.255.0 lockd: 192.168.3.0/255.255.255.0 rquatad: 192.168.3.0/255.255.255.0 statd: 192.168.3.0/255.255.255.0 sshd: ALLNFS SERVER in OSX
$ sudo nano /etc/exports /Volumes/data/music -ro 192.168.1.23fai partire portmap, mountd and nfsd
$ sudo /usr/sbin/portmap $ sudo /usr/sbin/mountd $ sudo /sbin/nfsd -t -u -n 6ogni volta che cambi /etc/exports, notifica mountd
(al riavvio, se vede una /etc/export starta i demoni automaticamente)
controlla che vada tutto bene:
$ showmount -e $ showmount -e nfsserver # da un altra macchina