Another NFS question. I’m reading Jay’s book Mastering Ubuntu Server en trying to bring knowledge into practice.
On my server (ksm-server1, Ubuntu server 20.04) I created two NFS shares. This is my /etc/exports file on the server:
/exports *(rw,fsid=0,no_subtree_checks)
/exports/documents *(ro,no_subtree_checks)
/exports/public *(rw,no_subtree_checks)
I can mount the shares successfully on my client (PC2-Kees, Ubuntu 2004). Because the public folder is rw I can read and write files. So that seems to be ok. But…
As Jay mentioned in his book the UID’s and GUID’s for users and groups are different on both machines. So when I list the folder on my server (/exports/public) I see this:
kees@ksm-server1:~$ ll /exports/public/
total 16
drwxrwxrwx 2 root root 4096 Feb 6 18:18 ./
drwxr-xr-x 5 root root 4096 Feb 5 17:37 ../
-rw-rw-r-- 1 kees-beheer kees-beheer 14 Feb 6 18:18 file01.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file02.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file03.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file04.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file05.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file06.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file07.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file08.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file09.txt
-rw-rw-r-- 1 kees-beheer kees-beheer 0 Feb 6 15:24 file10.txt
-rwxrwxrwx 1 root root 13 Feb 5 18:20 test2_server.txt*
-rwxrwxrwx 1 root root 0 Feb 5 18:13 test_server.txt*
But when I list the share on my client (/mnt/public):
14:58 kees@PC2-Kees:~ $ ll /mnt/public/
totaal 16
drwxrwxrwx 2 root root 4096 feb 6 19:18 ./
drwxr-xr-x 6 root root 4096 feb 5 19:40 ../
-rw-rw-r-- 1 kees kees 14 feb 6 19:18 file01.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file02.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file03.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file04.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file05.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file06.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file07.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file08.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file09.txt
-rw-rw-r-- 1 kees kees 0 feb 6 16:24 file10.txt
-rwxrwxrwx 1 root root 13 feb 5 19:20 test2_server.txt*
-rwxrwxrwx 1 root root 0 feb 5 19:13 test_server.txt*
kees and kees-beheer are different users on both machines. UID 1000 on the server is for user kees-beheer, but UID 1000 on the client is for user kees.
To overcome this problem, Jay explains to edit the /etc/idmapd.conf file on both machines in such a way that they use the same domain:
# set your own domain here, if it differs from FQDN minus hostname
Domain = home
On the server command hostname --fqdn shows:
ksm-server1.home
On the client command hostname --fqdn shows:
PC2-Kees.home
So both use the same domain.
Maybe it is good to say that DHCP-server and DNS-server are running on my modem/router and is also set to domain = home.
What can I do to map the UID’s to the right user on both systems?