NFS settings in Linux

Source: Internet
Author: User
Article Title: NFS settings in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

  NFS Server settings

To set NFS Server, you must first check whether the Linux host supports the NFS service, and then set the user's source IP address or host name and the shared directory permission.

How can I use the shared directory in the Client PC? First, use showmount to check whether the Linux Server has an NFS directory that can be used. If yes, mount it on the local machine so that you can use the resources provided by the NFS Server host.

1. System Requirements

In addition to the two system daemon portmap and nfs-utils mentioned earlier, the Kernel version is better than 2.2.18. In addition, if you re-compile the kernel, you must choose to support NFS.

  2. etc/exports

Edit the/etc/exports file:

# Vi/etc/exports
/Usr/src/sys-maproot = daemon host2
/Usr/ports-ro-network 192.168.1.0

The above example shows the format of the exports file. First, it defines the file directory to be shared. The absolute path must be used instead of the symbolic connection. The following is the access restriction parameter for this Directory, which is used to ensure security. In the first row, the/usr/sys/src directory is shared, but the root user on the client is limited to the daemon user on the local machine, to prevent the root user on the client from having the root power on the server for illegal operations, the subsequent host2 parameter is the host name, this restricts that only host2 can share the/usr/sys/src directory. the/usr/ports directory is shared in the third row, but only read is allowed, only computers on the 192.168.1.0 network can access the shared directory.

◆ Rw erasable write permission.

◆ Read-only permission of ro.

◆ No_root_squash when the user logging on to the NFS host using the shared directory is root, the user's permissions will be converted to anonymous users. Generally, the UID and GID will become nobody identities.

◆ Root_squash: the user who logs on to the NFS host and uses the shared directory. If it is root, the shared directory has the root permission.

◆ All_squash no matter what the identity of the NFS user is, its identity will be converted into an anonymous user, usually the nobody.

◆ The anonuid is usually nobody. You can also set the UID value by yourself. The UID must exist in/etc/passwd.

◆ Anongid is the same as anonuid, but it is the group ID.

◆ Sync data is synchronously written to memory and hard disk.

◆ The async data will be saved in the memory first, rather than directly written to the hard disk.

3. Activate the service portmap and nfsd

#/Etc/rc. d/init. d/portmap start (or: # service portmap start)
#/Etc/rc. d/init. d/nfs start (or: # service nfs start)
After portmap is activated, a sunrpc service with the Port Number 111 will appear. As for nfs, at least two system daemon processes are activated, and then the requirement of the Client PC is monitored. You can check whether the operation is successful using cat/var/log/messages:

# Cat/var/log/messages
Nov 16 15:04:45 cao portmap: portmap startup succeeded
Nov 16 15:04:53 cao nfs: Starting NFS services: succeeded
Nov 16 15:04:54 cao nfs: rpc. rquotad startup succeeded
Nov 16 15:04:54 cao nfs: rpc. mountd startup succeeded
Nov 16 15:04:54 cao nfs: rpc. nfsd startup succeeded

[1] [2] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.