Blog categories

Comments

[Linux] Network File System(NFS) 설정하기

[Linux] Network File System(NFS) 설정하기

Edit exports setting for nfs on your host server and restart NFS server.

sudo apt-get install nfs-kernel-server
sudo vim /etc/exports
/nfsroot        192.168.0.0/24(rw,no_subtree_check,no_root_squash,async,insecure)
/home           192.168.0.0/24(rw,sync,no_subtree_check,no_root_squash)

sudo /etc/init.d/nfs restart
sudo service nfs-kernel-server restart

There are some permission options.

  • no_root_squash
    • Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does not apply to any other uids that might be equally sensitive, such as user bin.
  • root_squash
    • Turn off root squashing. This option is mainly useful for diskless clients.
  • all_squash
    • Map all uids and gids to the anonymous user. Useful for NFS-exported public FTP directories, news spool directories, etc. The opposite option is no_all_squash, which is the default setting.
  • anonuid and anongid
    • These options explicitly set the uid and gid of the anonymous account. This option is primarily useful for PC/NFS clients, where you might want all requests appear to be from one user. As an example, consider the export entry for /home/joe in the example section below, which maps all requests to uid 150 (which is supposedly that of user joe).

Examples:

/home           192.168.0.1/24(rw,sync,no_subtree_check,all_squash,anonuid=3000,anongid=3000)

If you use all_squash option with anonuid and anongid, all remote your became the 1001 user and join the group 1001.

Edit fstab setting on your client server.

sudo apt-get install nfs-common
sudo mount -t nfs -o nolock 192.168.0.1:/home /home

Then, fstab file in your client server will be:

sudo vim /etc/fstab
# <file system>                 <mount point>   <type>  <options>       <dump>  <pass>
192.168.0.100:/nfsroot          /               nfs     sync,ro,hard,intr,nolock        0       0
192.168.0.100:/home             /home           nfs     sync,rw,hard,intr,nolock        0       2

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

div#stuning-header .dfd-stuning-header-bg-container {background-image: url(https://tech.sangron.com/wp-content/uploads/sites/2/2018/04/ubuntu_wallpaper_background.jpg);background-color: #3f3f3f;background-size: cover;background-position: top center;background-attachment: initial;background-repeat: no-repeat;}#stuning-header div.page-title-inner {min-height: 350px;}