220 likes | 508 Views
Remote Disk Access with NFS. NFS Background. Developed inside Sun Microsystems in early 1980’s Based on 2 similar but distinct protocols MOUNT Initial Negotiation between Server and Client Determines which file systems are available for mounting
E N D
NFS Background • Developed inside Sun Microsystems in early 1980’s • Based on 2 similar but distinct protocols • MOUNT Initial Negotiation between Server and Client • Determines which file systems are available for mounting • NFS Allows Client to Utilize Files in Directory
NFS Description • Network File System(NFS) • An abbreviation for Network File System, a file format and set of drivers created by Sun Microsystems Incorporated that allows DOS/Windows and UNIX applications to share files on disk drives running under UNIX. NFS relies on remote procedure calls (RPCs) for communication between clients and servers. • Allows any network user to access disk space over a networks. • Incorporates with NIS to access specific file folders for each user
Important NFS Concepts • Virtual File System (VFS) – transparently and automatically redirects for mounted files to the server • Remote Procedure Call (RPC) – used for background mounting of a folder with a file system • Hard Mounting – Continuously trying to remount a file system • Soft Mounting – Repeated RPC failures cause the NFS to fail and not hang
Important NFS Daemons • portmap – manages connections for applications that use the RPC specification • nfs – starts necessary RPC processes • nfslock – allows clients to lock files within the NFS file system • netfs – allows processes running on the client to mount an NFS file system
Installing NFS • RedHat Linux installs NFS by default • Automatically activated when system boots • To check: • rpm –qa | grep nfs • If list is empty, one needs to installed • Another way : • yum install nfs*
Configuring NFS on the Server • Needs • portmap • nfs • nfslock • Correctly configured /etc/exports file
Configuring the /etc/exports file • Main NFS configuration file • 2 columns: • 1st Directories made available on the network • 2nd Networks or DNS domains that can access the directories and options • Options include: • ro, rw, no_root_squash, no_subtree_check, sync
The /etc/exports file #/etc/exports /public 134.198.161.101(rw, sync, no_root_squash) /public 134.198.161.102(rw, sync, no_root_squash) /public 134.198.161.103(rw, sync, no_root_squash) /public 134.198.161.104(rw, sync, no_root_squash) /public 134.198.161.254(rw, sync, no_root_squash) • NFS Users Control Panel in Linux
Starting NFS on the Server • Configure required daemons chkconfig –level 35 nfs on chkconfig –level 35 nfslock on chkconfig –level 35 portmap on • Use /etc/init.d to start daemons service portmap start service nfs start service nfslock start • Test NFS rpcinfo –p localhost
Starting NFS on the Client • Configure required daemons chkconfig –level 35 netfs on chkconfig –level 35 nfslock on chkconfig –level 35 portmap on • Use /etc/init.d to start daemons service portmap start service netfs start service nfslock start • Test NFS rpcinfo –p
NFS Directory Mounting -- Temporary mkdir /home ls /home mount –t nfs 134.198.161.103:/public /home ls /home <Listing of Directory>
Security Levels • “Share-wide”: authorized clients can access any file under that share. • “File-level”: before accessing any file, client needs to be authenticated; in fact, client authenticated once and uses UID for future accesses.
Server security: nfsd and mountd • On the server we can decide that we don't want to trust any requests made as root on the client. We can do that by using the root_squash option in /etc/exports: /home slave1(rw,root_squash)
This is, in fact, the default. It should always be turned on unless you have a very good reason to turn it off. To turn it off use the no_root_squash option. • Now, if a user with UID 0 (i.e., root's user ID number) on the client attempts to access (read, write, delete) the file system, the server substitutes the UID of the server's 'nobody' account. Which means that the root user on the client can't access or change files that only root on the server can access or change.