I'm taking reference of apache server in which www-data
will be the server group. Follow the same for other servers as well.
This is related to ownership issue. Since you are running php bin/magento enable:module
as your pc user the files ownership must have changed to your-user-name:your-user-name
instead of www-data:www-data
or your-user-name:www-data
.
To solve this issue you must set group www-data
as group and you can either place yourself as owner or give complete ownership to www-data
of magento files. In the case you set yourself as an owner you must add yourself to the server's group i.e. www-data
.
Next you need to run find var -type d -exec chmod g+s {} \;
What this does is that all new files and subdirectories created within the current directory inherit the group ID of the directory, rather than the primary group ID of the user who created the file. This will also be passed on to new subdirectories created in the current directory.
I hope this works for you.