Unable to set magento user permissions


I stared working on a webiste that’s already up and running using Magento 2.3 and Ubuntu 18.04.

I have been following this guideline to set up a new Magento user:

But after this command:

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

but for some reason I get chmod: changing permissions : Operation not permitted
And no rights where changed.

Have any idea? Thanks!

Hi @NickeGilbert and welcome,

It’s likely you’ve run something out-of-order during the setup. Without knowing what that was, it’s hard to say if you’ll run into anything else further down the line.

Resetting Owner and Group

Anyway, to resolve your current issue just run this as your superuser (from any location) - Then continue where you left off. This will ensure both Owner and Group are correct:

sudo chown -R magento:www-data /var/www/html/

Therefore, you’re setting the Owner to “magento” and the Group as “www-data”, as laid out in the original Tutorial.

For more information, see How to diagnose and fix Ownerships and Permission issues

Executing commands as the correct user

Alternatively, your issue might be caused because you’re not switched to the “magento” (su magento) user before executing the aforementioned commands.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.