Ubuntu: Permission issues - cannot write www-data:www-data /var/www [duplicate]



Question:

This question already has an answer here:

When I set up a site on my server I set permissions to /var/www/ like so:

chown -R $USER:$USER var/www/  

However, when I try and write to my image directory I get a permission denied error. The only way I have found is setting the permissions like this:

chown -Rf www-data.www-data /var/www/  

So this fixes that problem, but creates another one. Now I cannot save any files to my server via ftp on my ide.

I'm a bit new to this and don't fully understand the difference between the two ways of setting permissions. Any help would be appreciated.

EDIT Not a dupe. I've done my research. This is not an issue about using sudo in /var/www. I'm getting permission denied errors when generating and trying to save images to a specific directory using GD Lib.


Solution:1

You need to set write_enable to be able to write files to your FTP server.

Open Terminal (Ctrl+Alt+T), and Type:

sudo nano /etc/vsftpd.conf  

Change the line:

#write_enable=YES  

To this:

write_enable=YES  

Make sure you have:

chroot_local_user=YES  

And add the following parameter:

allow_writeable_chroot=YES  

Then, Restart:

sudo service vsftpd restart  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »