After copying all files / db on my local VB when I tried to setup permissions:

find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} + && chown -R :apache . && chmod u+x bin/magento

Getting error [chown: invalid group: ‘:apache’]

I can see that apache is installed and running.

#sudo apache2ctl configtest: Syntax OK

#sudo a2enmod rewrite: Module rewrite already enabled

#sudo systemctl restart apache2: OK

#sudo ufw allow 'Apache full': Skipping adding existing rule: Skipping adding existing rule (v6)

#Sudo ufw allow ssh: Skipping adding existing rule: Skipping adding existing rule (v6)

Am working on Magento 2.4.3 on Ubuntu 20.04.3 LTS, PHP 7.4.3 with MySQL 8. Exactly same as my live site.

2 Answers 2


There would be no "apache" user group by default in Ubuntu. If you want to give the permission to the user group for apache, the default user group it lies under is "www-data", so replace the "apache" in the command to the "www-data" wherever you are mentioning the user group.

You can get some further reading here - https://askubuntu.com/questions/873839/what-is-the-www-data-user


may be your magento file is not permitted for current group and user.

First get your current user name with whoami command.


check current file owner with ls -l

and assign current group and user to your magento with chown command.

Ex: chown youruser:yourgroup Magentodir

you can get more details from devdoc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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