Configure network file sharing server NFS in Ubuntu

Source: Internet
Author: User
Environment: Ubuntu8.04.3LTS (2.6.24-24-generic) + nfs-kernel-server1: 1.1.2-4ubuntu1. 1NFS server address: 192.168.0.2 one of the client addresses: 192.168.0.31 & gt; by default, the tunfs server is not installed on tunfsubuntu. Therefore, we first install the tunfs Server:

Environment: Ubuntu 8.04.3 LTS (2.6.24-24-generic) + nfs-kernel-server. 1.2-4ubuntu1. 1

NFS server address: 192.168.0.2
One client address: 192.168.0.3

1> install Ubuntu nfs

By default, the Ubuntu nfs server is not installed on Ubuntu. Therefore, we must first install the Ubuntu nfs server:

  1. Roger@Ubuntu:/# Apt-get install nfs-kernel-server

In some documents, it is suggested that you also need to use apt-get to manually install nfs client nfs-common and port er portmap. However, this is not necessary, this is because apt automatically installs nfs-kernel-server for us.

2> Configure/etc/exports

The directory and permissions that Ubuntu nfs allows to mount are defined in the file/etc/exports.
For example, to share the rogerdir directory under the root directory, we need to add the following line at the end of the/etc/exports file:

  1. /Rogerdir*(Rw,Sync,No_root_squash)

Where:/rogerdir is the directory to be shared, * indicates that all network segments are allowed to access (it can be set to 192.168.0.3, only 192.168.0.3 is allowed), rw is the read/write permission, sync is used to synchronously write data to the memory and hard disk. no_root_squash is the permission of the Ubuntu nfs client to share the directory user. If the client uses the root user, for this shared directory, the client has the root permission.

Common Parameters for Ubuntu nfs include:

  1. RoRead-only access
  2. RwRead/write accessSyncWrite and share all data upon request
  3. Async NfsYou can respond to the request before writing data.
  4. Secure NfsPass1024The following securityTCP/IPPort sending
  5. Insecure NfsPass1024Send the above Port
  6. WdelayIf multiple users want to writeNfsDirectory, group write (default)
  7. No_wdelayIf multiple users want to writeNfsDirectory.AsyncThis setting is not required.
  8. HideInNfsThe shared directory does not share its subdirectories.
  9. No_hideShareNfsSub-directory
  10. Subtree_checkIf shared/Usr/BinWhen Sub-directories suchNfsCheck the permissions of the parent directory (default)
  11. No_subtree_checkThe parent directory permission is not checked as opposed to the above.
  12. All_squashShared FileUIDAndGIDIng Anonymous UsersAnonymousSuitable for public directories.
  13. No_all_squashReserved shared fileUIDAndGID(Default)
  14. Root_squash RootAll user requests are mappedAnonymousSame user permissions (default)
  15. No_root_squas RootThe user has full management access permissions to the root directory.
  16. Anonuid=XxxSpecifyNfsServer/Etc/PasswdFileUID
  17. Anongid=XxxSpecifyNfsServer/Etc/PasswdFileGID

3> Ubuntu nfs Restart service

  1. Roger@Ubuntu:/#/Etc/init. d/nfs-kernel-server restart

4. Test Ubuntu nfs

Run the following command to display the shared directory:
$ Showmount-e
Alternatively, you can use the following command to mount it to a local disk, for example, Mount/rootfs to/mnt:
$ Sudo mount-t nfs localhost:/rogerdir/mnt
Run the df command to check whether the mounting is successful. Run the following command to uninstall the SDK:
$ Sudo umount/mnt

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.