[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:network_services:nfs-quick_and_dirty_setup [2014/01/20 23:15 (UTC)] – [Problems/Solutions] Fixed code blocking arfonhowtos:network_services:nfs-quick_and_dirty_setup [2019/10/08 04:38 (UTC)] (current) – Fix filename typo per Skaendo on LQ forum bassmadrigal
Line 1: Line 1:
 <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
-Known to work on Slackware 14 14.1 \\ +====== NFS - Quick and Dirty Setup ====== 
 + 
 +Known to work on Slackware 1414.1 and 14.2 \\ 
  
 ====== Assumptions ====== ====== Assumptions ======
Line 17: Line 19:
 <code>vi /etc/exports</code> <code>vi /etc/exports</code>
 add: \\  add: \\ 
-<code>/nfs_share 192.168.1.1/24(rw,sync,no_subtree_check)</code>+<file sh /etc/exports>/nfs_share 192.168.1.1/24(rw,sync,no_subtree_check)</file>
  
 Start the NFS and RPC daemons \\  Start the NFS and RPC daemons \\ 
Line 23: Line 25:
 chmod 755 /etc/rc.d/rc.rpc chmod 755 /etc/rc.d/rc.rpc
 /etc/rc.d/rc.nfsd start /etc/rc.d/rc.nfsd start
-/etc/rc.d/rpc start</code>+/etc/rc.d/rc.rpc start</code>
  
 Export the shares \\ Export the shares \\
Line 34: Line 36:
 Create the mount point \\  Create the mount point \\ 
 <code>mkdir /mnt/nfs_share</code> <code>mkdir /mnt/nfs_share</code>
 +Start the RPC daemon \\ 
 +<code>chmod 755 /etc/rc.d/rc.rpc
 +/etc/rc.d/rc.rpc start</code>
  
  
Line 46: Line 51:
 <code> vi /etc/fstab</code> <code> vi /etc/fstab</code>
 add: \\  add: \\ 
-<code>my.nfs.server:/nfs_share /mnt/nfs_share nfs rw,defaults 0 0</code>+<file sh /etc/fstab>my.nfs.server:/nfs_share /mnt/nfs_share nfs rw,defaults 0 0</file>
  
 **SEMI-AUTO-MOUNT** \\  **SEMI-AUTO-MOUNT** \\ 
Line 52: Line 57:
 <code> vi /etc/fstab</code> <code> vi /etc/fstab</code>
 add: \\  add: \\ 
-<code>my.nfs.server:/nfs_share /mnt/nfs_share nfs rw,noauto 0 0</code>+<file sh /etc/fstab>my.nfs.server:/nfs_share /mnt/nfs_share nfs rw,noauto 0 0</file>
 then when you want to mount, just run: \\  then when you want to mount, just run: \\ 
 <code>mount /mnt/nfs_share</code> <code>mount /mnt/nfs_share</code>
Line 67: Line 72:
 chmod 755 /etc/rc.d/rc.rpc chmod 755 /etc/rc.d/rc.rpc
 /etc/rc.d/rc.nfsd start /etc/rc.d/rc.nfsd start
-/etc/rc.d/rpc start+/etc/rc.d/rc.rpc start
 exportfs -a</code> exportfs -a</code>
  
 **CLIENT:** \\  **CLIENT:** \\ 
 <code>mkdir /mnt/nfs_share <code>mkdir /mnt/nfs_share
 +chmod 755 /etc/rc.d/rc.rpc
 +/etc/rc.d/rc.rpc start
 echo "YOUR_NFS_SERVER:/SHARED_DIR /CLIENT_MOUNT_POINT nfs rw,defaults 0 0" >> /etc/fstab echo "YOUR_NFS_SERVER:/SHARED_DIR /CLIENT_MOUNT_POINT nfs rw,defaults 0 0" >> /etc/fstab
 mount /CLIENT_MOUNT_POINT mount /CLIENT_MOUNT_POINT
Line 86: Line 93:
 3) Remount the NFS share 3) Remount the NFS share
  
 +4) No Root Squash:
 +There are many options for NFS and I want to keep this article short but effective so I am leaving out many of the various configuration items that you could do. However there is one option that is worth mentioning, **no_root_squash**. By default NFS will downgrade any files created with the root permissions to the nobody user. This is a security feature that prevents privileges from being shared unless specifically requested.
 +If I create a file as the root user on the client on the NFS share, by default that file is owned by the nobody user.
 +<code>
 + root@client:~# touch /shared/nfs1/file2 
 + root@server:/nfs# ls -la file2
 + -rw-r--r-- 1 nobody nogroup 0 Nov 18 18:06 file2
 +</code>
 +Sometimes it is important to share files that are owned as root with the proper permissions, in these cases this can be done by simply adding the **no_root_squash** attribute to the **/etc/exports** configuration.
  
- +**Edit the /etc/exports file:** 
 +<code> 
 +/nfs_share 192.168.1.1/24(rw,sync,no_root_squash) 
 +</code>
 ====== Sources ====== ====== Sources ======
 <!-- If you are copying information from another source, then specify that source --> <!-- If you are copying information from another source, then specify that source -->
 howtos:network_services:nfs-quick_and_dirty_setup ()