How to make a directory permanently writable?

Solution 1:

Numeric permissions can solve your problem.

sudo chmod 775 'your directory'

if you want to know why only 775 here's your answer

400 read by owner
040 read by group
004 read by anybody
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

 400
+040
+004
+200
+020
+100
+010
+001
=775

It will give all permission except write by anybody.

Solution 2:

I had the same problem then

sudo chmod 777 directory

solved it.

That makes the directory writable, readable and executable by anybody. So doesn't matter what user or group owned it or used Lampp.

However, that isn't recommended if your computer is public access.

Solution 3:

Usually the command you used should change the permissions permanently.

Try sudo chmod -R 775 /var/www/ (which basically is the same). If that doesn't work you might need to change the owner [and maybe the group] of the directory via sudo chown <user>[:<group>] /var/www/.

Also, you might consider the 'permission denied error' could be caused by insufficient access rights in your database or elsewhere.