Every time I run composer (e.g.,
sudo composer install, sudo composer self-update etc.) I need to run this with sudo as the owner of the file is root.
However every time I use the composer with sudo root owns the vendor folder and then I have to change the owner of that folder/privileges from root to www-data.
What is the best way to fix this so I do not have to run sudo every time?
Change the owner of
/usr/local/bin/composer from root to www-data?
Is this the ideal way to handle this to avoid having to change ownership and assign permission every time I use sudo
The permissions for composer are currently
-rwxr-xr-x. And I've tried switching the owner of
/usr/local/bin/composer over to
www-data:www-data with permissions set to 775, and still I can't run composer without running