Debian 12 and NFS sharing

Solved
emrh Posted messages 439 Status Member -  
emrh Posted messages 439 Status Member -

Good evening,

I had an old PC running Debian 9. I accessed the files stored in /var/www/html on that machine from my laptops (Linux Mint) via a share and an NFS mount.
I replaced the HDD with a new one on which I installed Debian 12, copied my old files to the same location, and set up my NFS share again, but I'm getting an access denied message:

mount.nfs: access denied by server while mounting 192.168.0.132:/var/www/html

I can ping the machines from both sides.
My exports file on Debian:
# SHARED FOLDERS:
# 1st test:
#/var/www/html/ 192.168.0.*(rw,all_squash,anonuid=1000,anongid=1000,sync)
# 2nd test:
/var/www/html/ 192.168.0.*(rw,no_all_squash,anonuid=1000,anongid=1000,sync,subtree_check)

I did a chmod 777 /var/www/html on Debian.

I deleted and recreated the mount directory, then on my Mint 21 laptop:
sudo chmod -R 755 /media/DONNEES
sudo chown etienne:etienne /media/DONNEES


I still cannot access files or directories where I am the owner, nor those owned by root (I have a test mount on a root directory with exports pointing to that same directory, but still the same error!). I thought for a moment it was due to how I copied my old files, but I have the same problem with sharing a directory and a txt file created from the Debian terminal.

I removed the DHCP from my Freebox Revolution for the Debian server to recreate it on the same address with the same name (server).

Thank you in advance for your troubleshooting ideas because I really don't know where to look anymore!

3 answers

  1. emrh Posted messages 439 Status Member 20
     

    I just solved my problem like this:

    /etc/exports :

     # SHARED FOLDERS : /var/www/html/ 192.168.0.0/24(rw,all_squash,anonuid=1000,anongid=1000,sync,no_subtree_check)



    with 192.168.0.0/24 instead of 192.168.0.*

    By specifying the subnet 0/24 in the NFS configuration, we create a more generic rule that allows access to all machines in this subnet without having to specify each IP address individually. With the subnet mask /24, we specify that the first 24 bits of the IP address are used to identify the network, and the remaining 8 bits are used to identify the hosts within this network. This therefore covers all the IP addresses in the subnet 192.168.0.0/24.

    2
  2. emrh Posted messages 439 Status Member 20
     

    Thank you @Domy31 StatusMember for this interesting link that unfortunately did not help me solve my problem.


    I initially struggled for a while to understand why fdisk wasn’t working (adding export PATH="$PATH:/usr/sbin" to /etc/bash.bashrc)!!!


    In my case, I don't need to mount an external HDD on the server because I'm looking to share a directory from the server via NFS on my local network (/var/www/html/). Besides, I have nothing in /media

    1
  3. Domy31 Posted messages 374 Registration date   Status Member Last intervention   181
     

    Good evening

    I'm sending you the link that helped me do what you asked, but I followed it to the letter and I'm not very knowledgeable about it.

    If this can help you.

    Network sharing of USB hard drive with NFS

    Have a good evening


    0