-
Install the server packages in vm0:
[vm0] $ sudo apt-get install nfs-kernel-server
- Export the entire file system. Edit the file
/etc/exports
in vm0, adding this line:
/ *(rw,sync,no_subtree_check)
- Restart the server:
[vm0] $ sudo /etc/init.d/nfs-kernel-server restart
- Install the client software in MACHINE:
$ sudo apt-get install nfs-common
- Create a suitable directory onto which we will mount vm0's root:
$ sudo mkdir /vm0
Feel free to choose some other directory.
- Mount vm0's root onto /vm0
$ sudo mount vm0:/ /vm0
$ ls /vm0
You're seeing vm0's file system.
- Try some accesses:
$ ls /vm0/home/LOGIN
$ sudo ls /vm0/root
The latter says "permission denied," but
I thought I was root! No, sir!.
You're not root on the nfs server.
This effect is called root squash.
It's a security measure so that root
on a client system does not translate into root on the server by default.
If you want this feature, the server has to mention it explicitly
in the /etc/exports line.
- Get out and try again. First, on client
$ sudo umount /vm0
Then, on vm0, edit /etc/exports, changing the line to this:
/ *(rw,sync,no_subtree_check,no_root_squash)
and restart the server:
[vm0] $ sudo /etc/init.d/nfs-kernel-server restart
- Try again
$ sudo mount vm0:/ /vm0
$ sudo ls /vm0/root
© Robert M. Kline