So, I am trying to connect two Ubuntu computers using a NFS connection On the server, I made the following
Install NFS Server on Ubuntu
$ sudo apt-get install nfs-kernel-server portmap
Export shares over NFS
$ sudo mkdir /opt/share $ sudo chown nobody:nogroup /opt/share
Edit the NFS server exports configuration file
$ sudo gedit /etc/exports
Add the following settings
/home 192.168.0.0/24(rw,sync,no_root_squash,no_subtree_check) /opt/share 192.168.0.0/24(rw,sync,no_subtree_check)
Apply the new settings by running the following command. This will export all directories listed in /etc/exports file
$ sudo exportfs -a
On the client side, I tried to use the sys/mount library to make the NFS connection
if(mount(":/mnt/share","/opt/share","nfs",0,"nolock,addr=192.168.0.101") == -1)
{
printf("NFS ERROR: mount failed: %s \n",strerror(errno));
}
else
{
printf("NFS connected\n");
}
But it returns
m@m-ThinkPad-L15-Gen-2:~/Desktop/teste$ sudo ./mountnfs
NFS ERROR: mount failed: Permission denied
Does anybody have any clue of what is happening?