# Share folder with nfs and idmap
###### tags: `c4lab`
## Result: not work
http://dfusion.com.au/wiki/tiki-index.php?page=Why%20NFSv4%20UID%20mapping%20breaks%20with%20AUTH_UNIX
## 1. Setup nfs-server
Follow https://www.howtoforge.com/tutorial/setting-up-an-nfs-server-and-client-on-centos-7/
### 2. Enable Mapping
Follow https://unix.stackexchange.com/questions/438939/how-to-get-nfsv4-idmap-working-with-sec-sys
In `/etc/fstab`
``` fstab
/home rna(ro,sync,sec=sys,no_root_squash,no_subtree_check)
```
### 3. Setup Mapping
`/etc/idmapd.conf` should be set both in server and client.
```
[Mapping]
Method = static
[Static]
#someuser@REALM = localuser
linnil1@rna = linnil1
linnil2@rna = linnil2
```
Reload in server
```
systemctl restart rpcbind nfs-idmapd
nfsidmap -c
exportfs -ra
```
Reload in client
```
nfsidmap -c
```
4. Mount it
For one time mount
```
mount -t nfs4 other_machine_ip:/home other_machine
ls -al other_machine
umount other_machine
```
For permantly mount
In `/etc/fstab`
```
other_machine_ip:/home /home/other_machine nfs nolock,intr,soft,bg,actimeo=3 0 0
```
Reference of [fstab setting](https://linux.die.net/man/5/nfs)