Give Normal User Write Access to /var/www

Here’s a quick way to allow a normal user write access to the /var/www directory so that they can work with web server files without the need to login as root first. Open the terminal and issue the commands:

sudo chown -R `id --user` /var/www/
sudo chgrp -R `id --user` /var/www/

If you don’t have sudo enabled on your distro, remove ‘sudo’ from the commands and login as root first before executing them with ‘su’.

You should now be able to write to all the files within /var/www/. My only other suggestion is that you can be a bit more selective about what directories and files are allowed write access by removing the recursive option “-R” from the command.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:

There's 1 Comment So Far

  • thewanderer
    June 16th, 2011 at 1:53 pm

    Be sure to check out http://wiki.debian.org/Permissions – it has many tips with in-depth explanations of every use case, as well as a section on ACL for fine-grained access control. Personally, I do use ACL for websites, and I find the system quite effective, without “user private groups”.

Share your thoughts, leave a comment!