land@ns331252:/var/www/html$ ls -al
total 24
drwxr-xr-x 2 root root 4096 Aug  5 02:39 .
drwxrwxrwx 7 root root 4096 Aug  6 07:27 ..
-rwxrwxrwx 1 land land 8839 Aug  5 02:39 file.here.txt
-rwxrwxrwx 1 root root  612 Aug  4 12:49 index.nginx-debian.html

I did chmod 775 /var/www/ aswell tried chmod 777 /var/www/

Still problem persist. I also try to create a dir…

31252:/var/www/html$ mkdir test
mkdir: cannot create directory ‘test’: Permission denied

Not sure why I still get permission denied.

1 Answer 1


drwxr-xr-x 2 root root 4096 Aug 5 02:39 .

This directory belongs to root:root and does not have write permissions for group or others set. Do you see the problem now?

  • Yes I do, The files That id like to be written is From Land user how would I go about it ? Commented Aug 6, 2018 at 15:48
  • For example, without making the directory world-writeable: sudo touch /var/www/html/file_here.xml.tmp, sudo chown Land /var/www/html/file_here.xml.tmp If that file is deleted again you run into the same problem, and so, you must change the permissions of the directory: sudo chmod 777 /var/www/html
    – Janka
    Commented Aug 6, 2018 at 16:53
  • Or you could change the owner of that directory. From a security standpoint, I'd probably change the user rather than allowing world to write into a directory owned by root. Usually I just have the owner of the /var/www directory be pi:www-data
    – NomadMaker
    Commented Aug 6, 2018 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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