O'Reilly logo

CompTIA® Linux+ Certification, Powered by LPI, Student Manual by Axzo Press

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

112 CompTIA Linux+ Certification, Powered by LPI
Topic A: Network file resources
This topic covers the following CompTIA exam objectives for Linux+ [Powered by
LPI] Certification, LX0-101 and LX0-102 exams.
# Objective
110.2 Set up host security
The following is a partial list of the used files, terms, and utilities:
/etc/hosts.allow
/etc/hosts.deny
The Network File System (NFS)
Explanation
The Network File System (NFS) is a file system type supported by Linux and UNIX
(and Windows, with third-party software) that enables you to access directories and
their files across the network. Once you have mounted a remote file system with NFS,
you can use it as if it were on your local computer.
An NFS server exports some or all of a file system to make it available on the network.
NFS clients mount those exported file systems in order to make their contents available
to the user or programs on the client.
NFS server packages
Depending on your installation choices and distribution, NFS is probably not installed
by default on your system. When you install the NFS server package, you can typically
choose between a user-space and kernel version of the server. The kernel version offers
more features, is faster, and is more stable than the user-space version. Choose the
kernel version, unless you have to use the other.
The current version of NFS is 4. Most Linux distributions support this version, plus one
or more previous versions. For best security and the widest range of options, use the
newest version of NFS available on your system.
Name resolution requirements
While you can use IP addresses with NFS, host names are far more convenient. To use
computer names, you must provide name resolution services on your network for
enabling remote file access. For a small network, distributing a common hosts file is
sufficient. Otherwise, you need to set up a DNS server to provide such services.
File sharing and printing 113
Do it! A-1: Enabling local name resolution and installing NFS
Here’s how Here’s why
1 Open a root terminal window or
open normal terminal window and
su to root
(The password is !pass1234.) Most of the
upcoming tasks require root level access. You
can use sudo with each command instead.
2 Enter ifconfig
Record your IPv4 address
IP address: ________________
3 Enter hostname
Record your computer’s name
Hostname: ________________
4 Share this address and name with
your lab partner
If you’re keying the activities by yourself, you
need a second computer running Linux.
Determine and record its hostname and IP
address now.
Record his or her information
IP address: ___________________
Hostname: ___________________
5 Enter vi /etc/hosts
After the existing entries in the
IPv4 section, add a new entry for
your partner’s computer
Follow the format of the existing entries.
Enter :wq
To save your changes and quit.
6 After your partner has finished
editing his or her hosts file, try
pinging her computer, using its
host name
If you’re unsuccessful, re-edit the hosts file and
check for errors in the name, address, or
formatting.
7 Use the Synaptic Package
Manager to install the
nfs-kernel-server package
and its dependencies
Close Synaptic
When you’re done.
114 CompTIA Linux+ Certification, Powered by LPI
NFS server configuration files
Explanation There are three primary configuration files for NFS, which are described in the
following table. You edit these files to configure your NFS server, the one exporting file
systems that the clients use.
File Use this file to configure
/etc/exports Which file systems are exported, the permissions for those file systems, and
which hosts may mount them.
/etc/hosts.allow Which hosts are permitted to mount exported file systems. While you can
configure this sort of information in the /etc/exports file, you have finer-
grained control via entries in this file.
/etc/hosts.deny Which hosts are explicitly denied permission to mount exported file systems.
While you can configure this sort of information in the /etc/exports file, you
have finer-grained control via entries in this file.
The /etc/exports file
You use this file to specify which file systems or portions of file systems are exported.
The syntax you use in this file varies, depending on the version of NFS you are using.
Primarily the differences lie in the options you specify for each connection. The
contents of the initial /etc/exports file are shown in Exhibit 11-1.
Exhibit 11-1: A sample /etc/exports file

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required