How to avoid using sudo when working in /var/www?
Permissions mystify me. I'm worried about compromising the security of my folder, too, since it's public.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
To give only your user permission to /var/www. You want to change the group owner to your primary group. If your username is joe this is how you would do it.
sudo chgrp joe /var/www
You then need to chmod the directory so its writable by the group joe.
sudo chmod 775 /var/www
after that you can write to /var/www
If you want to be able to edit and delete existing files. You need to take ownership of them.
sudo chown -R joe /var/www/*