1

I've a file in my mount directory, that root can delete, but the same file can not be deleted by www-data (Debian apache)

Here the apache srv81 fstab mount :

192.168.0.122:/home/landing       /mnt/landing      nfs             defaults                0 0

Here /etc/exports nfs srv122 :

/home/landing 192.168.0.81(rw,all_squash,anonuid=1001,anongid=1001,sync) 

/etc/passwd of srv122 :

imageemailing:x:1001:1001:Compte FTP,,,:/home/imageemailing:/bin/bash

Folder shared of srv122 :

root@srv122:/home# ls -lah
drwxr-xr-x  6 root          root          4,0K déc.  27 16:27 .
drwxrwxrwt  5 imageemailing imageemailing 4,0K janv.  9 18:24 landing

File that I can't remove view from srv122 :

root@srv122:/home/landing# ls -lah
-rw-r--r-- 1 imageemailing imageemailing  409 janv.  9 18:24 0.zip

File that I can't remove view from srv81 :

root@srv81:/mnt/landing()$ls -lah
-rw-r--r--  1 nobody nogroup  409 janv.  9 18:24 0.zip

user www-data can not remove :

root@srv81:/mnt/landing()$su www-data
$ pwd
/mnt/landing
$ rm 0.zip
rm: impossible de supprimer « 0.zip »: Opération non permise

As I understood un diffrent docs, all_squash should hide the native user and replace by local user 10001, no ? Why www-data can't remove my file 0.zip, but root can ?

EDIT 1

To anwser to comment, please find the result of ls -ln, it show that file have id 1001 on srv122 :

root@srv122:/home/landing# ls -ln
-rw-r--r-- 1 1001 1001  409 janv.  9 18:37 0.zip

I don't have ID 1001 on srv81. I decided to change export file configuration to allow RW from id & group ID 33 (www-data) (and restart nfs-kernel-server), because it's an user that i've in both side. I did a chown www-data:www-data -R to all my folder, and it work, my local file in NFS server is www-data (33) :

root@srv122:/home/landing# ls -ln
-rwxrwxrwx 1 33 33  409 janv.  9 18:37 0.zip

But I still can't remove file from srv81. id groupID view from srv81 :

$ ls -ln
-rwxrwxrwx 1 65534 65534  409 janv.  9 18:37 0.zip
  • Matching UID and GID is important. When listing these files on both machines, use ls -nl to display their numeric IDs. – Spooler Jan 9 '18 at 20:30
  • Thank you, I've updated my question, file is show as "nobody nogroup" (id : 65534 65534), even if I try to use an user in both side like www-data (id 33/33). – NicoMinsk Jan 9 '18 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.