> For the complete documentation index, see [llms.txt](https://notes.anir0y.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.anir0y.in/linux/nfs-configs.md).

# NFS Configs

## NFS installation

### install nfs server kernal

```bash
sudo apt update
sudo apt install nfs-kernal-server -y 
```

### make a directory

````bash
# in my desktop
mkdir ~/Desktop/nfs-share
#change permission
sudo chown nobody:nogroup ~/Desktop/nfs-share 

#add world writable permission
sudo chmod 777 ~/Desktop/nfs-share

### enable share

edit /etc/exports

```bash
#added this line
# this is for network CIDR
/home/anir0y/Desktop/nfs {IP}/{subnet}(rw,sync,no_subtree_check)
# example:
/home/anir0y/Desktop/nfs 192.168.29.0/24(rw,sync,no_subtree_check)
````

### restart NFS

```bash
# enable shares
sudo exportfs
# restart the service
sudo systemctl restart nfs-kernel-server.service
```

## add NFS share as client

### install nfs client

```bash
sudo apt update
sudo apt install nfs-common -y
```

### mount share

```bash
# make a mounting dir
mkdir ~/nfsclient
sudo mount -t nfs {IP}:{folder} {local_path}
#e.g.
sudo mount -t nfs 192.168.29.83:/home/anir0y/Desktop/nfs ~/nfsclient
```
