How I edit index.html? My droplet is Ubuntu LAMP on 14.04

November 14, 2014 4k views

I just created a droplet Ubuntu LAMP on 14.04. I am trying to change index.html via filezilla in s Howevere, when I upload my index.hmtl I get the error Error: /var/www/html/index.html: open for write: permission denied. I am following this tutorial: and everything worked fine until this point. What should I do? I also granted the permissions to "miusuario" suggested in this Tutorial: so I added the lines in visudo:

miusuario ALL=(ALL:ALL) ALL

Thanks in advance

1 comment
  • I am using WINSCP to edit files in var/www/html, and am having a similar problem (I can edit
    index.html, but am denied permission to save it). I tried the same three sudo commands you show, and this partially solved the problem. The part of the problem that was solved is that the
    file was uploaded successfully, with the minor change I made. However, WINSCP still says '... but error occurred while setting the permissions and/or timestamp." Is there an additional 'sudo' command that might solve this problem?

1 Answer

If you want to be able to edit the file directly using Filezilla over SFTP, you'll need to add your user to the www-data group and allow all members of that group to edit files. Run:

sudo usermod -a -G www-data foo
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R g+rw /var/www/html/
Have another answer? Share your knowledge.