I have a directory that goes like this:

    drwxrwxrwx  6 www-data www-data     4096 Jun  8 10:21 ./
    drwxr-xr-x 31 user1    user1        4096 Jun  8 10:40 ../
    lrwxrwxrwx  1 www-data www-data       66 Jun  8 10:21 archive -> /media/user1/7f62b5e4-4fe7-43c2-b0d0-8dad6e5a2381/archive/

I try to create a file with touch in the symbolic link with the user www-data. I get this error:

$ sudo -u www-data touch archive/myfile
touch: cannot touch ‘archive/myfile’: Permission denied

The root directory and the archive directory are chmod 777.

But this works correctly

$ touch archive/myfile

What am I missing?


The permissions or owner of /media/user1/7f62b5e4-4fe7-43c2-b0d0-8dad6e5a2381/archive/ are apparently different from the symbolic link.

Do ls -ld /media/user1/7f62b5e4-4fe7-43c2-b0d0-8dad6e5a2381/archive/ to see their current values, and correct them accordingly with chmod and chown.

  • Here is what I get: drwxrwxrwx 3 www-data www-data 4096 Jun 8 11:43 /media/user1/7f62b5e4-4fe7-43c2-b0d0-8dad6e5a2381/archive/ See normaly the user www-data has the right to write in the directory – Etienne Jun 9 '16 at 18:18

I fixed the probleme by mounting the hard disk pointed by the symbolic link. In fact, media/ is the path set by default so you need to mount the disk to set a valid path. Here is a link were you can find how to automatically mount a hard disk : InstallingANewHardDrive

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.