accumulated collection of notes about my server shenanigans

Setting up NFS#

Ports: 2049

Server#

install the server package and enable the server:

apt install nfs-kernel-server
systemctl enable nfs-server

add shares to /etc/exports; for example:

<local-path> <remote-ip-(range)/CIDR>(rw,sync,no_subtree_check)

if the remote user has a different userid you can use nfsidmap; or use the simple approach of mapping all users to a specific uid on the server.

by adding all_squash,anonuid=<uid-of-choice> like this:

<local-path> <remote-ip-(range)/CIDR>(rw,sync,no_subtree_check,all_squash,anonuid=<uid-of-choice>)

you can then export your exports using

exportfs -arv

-a -> all -r -> reexport -v -> list exported shares

Client#

install the client package:

apt install nfs-common

mount your nfs share using:

mount -t nfs4 <nfs-server-ip/hostname>:<share-path> <local-path>

assuming that worked; add it to /etc/fstab so it gets mounted at boot

<nfs-server-ip/hostname>:<share-path> <local-path> nfs4 defaults,user,exec 0 0

if you arnt certain the share will always be available; add noauto

<nfs-server-ip/hostname>:<share-path> <local-path> nfs4 defaults,user,exec,noauto 0 0

and then use mount -a to mount it