LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By do0m at 2005-08-04 01:48
Easy NFS

NFS (Network File System) allows separate machines to mount partitions across the network. That is, it
allows you to mount remote filesystems on local machines like local drives.

This tutorial was tested with Gentoo and FreeBSD and mainly targeted at Linux, but it should work across
all platforms supported by NFS. If you need, refer to your documentation for details on your specific
platform. All the examples here should be modified to fit your network.


Setting up /etc/exports

Have your text editor at hand (I like nano or vim).

Before editing the exports file, you should view the man page (man exports).

The basic syntax of an exports entry looks something like this:

Code:
(directory,machine(s)(options,options))
/files 192.168.0.101(rw,no_root_squash)

There are several options you can provide, depending on how you intend to
share your directory. A complete list of available options are listed in
the exports man page. Here's a brief summary:

rw: read/write

ro: read-only

no_root_squash: allows root access on the server

I find no_root_squash useful for administrative work on my machines, but it
can have some security implications. Be careful with root access, as always.

You can also use wildcard characters in these entries, though it would be
unwise to do so. (Allowing access to EVERYONE is quite dangerous.)


Setting up /etc/hosts.allow

You may already be familiar with hosts.allow.

The basic syntax of a hosts.allow entry is

Code:
service: host

For example

Code:
portmap: 192.168.0.101

You will need to make the following entries in your hosts.allow file for
NFS:

Code:
portmap: (hosts)
lockd: (hosts)
mountd: (hosts)
rquotad: (hosts)
statd: (hosts)

(hosts) represents client machines. Multiple hosts must be separated by commas.


Setting up /etc/hosts.deny

The following entries are necessary in hosts.deny:

Code:
portmap: ALL
lockd: ALL
mountd: ALL
rquotad: ALL
statd: ALL

"ALL" excludes everyone who's not listed in /etc/hosts.allow.

This file follows the same basic syntax as hosts.allow.


Starting the daemons

These daemons may already be running for whatever reason. Check to see:

Code:
$ ps aux | grep (daemon)
The daemons needed are nfsd, lockd, statd, mountd, and rquotad.
Depending on your distro, these may be named differently.

NFS should be ready to accept connections. :)

Start the portmapper, lockd, and statd services on the client machine, and
begin enjoying your NFS setup.

Code:
$ mount 192.168.0.100:/files /blahasdf/files

$ umount /files
At this point, you should redo all configuration files for your efficiency and security.

by dabash on Sat, 2005-08-20 05:30
thanks¦,¦its¦good¦articale

by LOLobo on Thu, 2005-09-01 23:23
Quote:
Start the portmapper, lockd, and statd services on the client machine, and
begin enjoying your NFS setup.
The tutorial would be even more helpful if it contained information on how to start these services.


::Edit::
Found this code here
Code:
/etc/rc.d/rc.nfsd start
It proved extremely helpful as it started all of the necessary services.

by chr15t0 on Sun, 2009-09-27 14:30
The setting up of NFS in linux looks pretty much the same as it is using a Freebsd host if I compare this to this NFS setup tutorial for Freebsd systems mounting into a Linux guest system.

by fengli on Mon, 2009-12-07 01:04
thank you! this is a very good article

by dumdadum on Thu, 2010-04-01 04:26
Quote:
Originally Posted by LOLobo View Post
The tutorial would be even more helpful if it contained information on how to start these services.


::Edit::
Found this code here
Code:
/etc/rc.d/rc.nfsd start
It proved extremely helpful as it started all of the necessary services.
Yes, thank you very much for posting that line of code, it solved my problem. Just the fact that it starts all the necessary services is really helpful.

Damn I really like the Slackware community. People help each other. Bits and pieces here and there and bam everything is up and running.

Thanks so much (=

by CatMan3110 on Wed, 2013-10-23 21:13
Here is a link for a subnet calculator in case anyone is interested.

http://www.subnet-calculator.com/


  



All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration