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.

marked as duplicate by muru, Eric Carvalho, Kevin Bowen, David Foerster, waltinator Oct 22 '16 at 14:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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:


To this:


Make sure you have:


And add the following parameter:


Then, Restart:

sudo service vsftpd restart

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