I have two Ubuntu machines, one serving as an NFS server (Machine A) and the other as an NFS client (Machine B). I have configured the NFS server on Machine A as follows:
On Machine A:
- Installed the NFS server package:
sudo apt install nfs-kernel-server
. - Created a mount directory:
sudo mkdir /mnt/myshareddir
. - Edited the
/etc/exports
file to allow access to the directory:/mnt/myshareddir *(rw,sync,no_subtree_check,no_root_squash)
. - Restarted the NFS server service:
sudo systemctl restart nfs-kernel-server
.
On Machine B, I have installed the fuse-nfs
binary from the fuse-nfs repository and configured it to mount the NFS server as follows:
- Created a mount point:
mkdir -p /home/pankaj/mymountdir
. - Mounted the NFS server using the
fuse-nfs
command:fuse-nfs -n nfs://<nfs-server-ip>/mnt/myshareddir -m /home/pankaj/mymountdir
.
However, I am able to mount the NFS server without being prompted to enter credentials. I would like to configure the system to prompt for credentials every time I mount the NFS server. Has anyone encountered a similar issue or have any suggestions to resolve this? Am I missing something here?
I appreciate your help in advance. Thank you.
I have two Ubuntu machines, one serving as an NFS server (Machine A) and the other as an NFS client (Machine B). I have configured the NFS server on Machine A as follows:
On Machine A:
- Installed the NFS server package:
sudo apt install nfs-kernel-server
. - Created a mount directory:
sudo mkdir /mnt/myshareddir
. - Edited the
/etc/exports
file to allow access to the directory:/mnt/myshareddir *(rw,sync,no_subtree_check,no_root_squash)
. - Restarted the NFS server service:
sudo systemctl restart nfs-kernel-server
.
On Machine B, I have installed the fuse-nfs
binary from the fuse-nfs repository and configured it to mount the NFS server as follows:
- Created a mount point:
mkdir -p /home/pankaj/mymountdir
. - Mounted the NFS server using the
fuse-nfs
command:fuse-nfs -n nfs://<nfs-server-ip>/mnt/myshareddir -m /home/pankaj/mymountdir
.
However, I am able to mount the NFS server without being prompted to enter credentials. I would like to configure the system to prompt for credentials every time I mount the NFS server. Has anyone encountered a similar issue or have any suggestions to resolve this? Am I missing something here?
I appreciate your help in advance. Thank you.
Share Improve this question asked Jan 20 at 12:02 pkthapapkthapa 1,0712 gold badges17 silver badges28 bronze badges1 Answer
Reset to default 2NFS does not authenticate using credentials such as user and password. It restricts access based on client IP address*. Meaning you authenticate by your machine IP, not which user are you.
You have defined the IP restriction as *
meaning "no restriction" (any IP).
See similar question Mount network share with nfs with username / password.
*You can also authenticate to nfsv4 using Kerberos - a very complicated setup is required.