cancel
Showing results for 
Search instead for 
Did you mean: 

Set the minimum of the folder/file permissions to an user to install and custmize extentions

SOLVED

Set the minimum of the folder/file permissions to an user to install and custmize extentions

Hello 

I found a Magento developer that has some extensions which I need for my online store.

I created on Ubuntu 20.04 server, a new user "webdev01", for the Magento developer to use it to install and customize the extensions by using SSH.

1- How can I set the minimum of the folder/file permissions to the project folder and subfolders "Magento"?  so the "webdev01" user can install, customize and support extensions.

2- Does "webdev01" need to be a member of the www-data group?

3- Does "webdev01" need access to the MySQL database?       If yes, How can i set minimum permissions?

4- Should I edit something in the SELinux for "webdev01" users?

Please help me to do that by sending me the command line.

 

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Set the minimum of the folder/file permissions to an user to install and custmize extentions

Hello @nmicro70gm7302 

 

You need to set 775 for folders and subfolders and 664 for all type of files, and you should give 777 permission to var/ generated/ pub/static/ pub/media/

so you must run below commands to set permissions : 

find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento
chmod 777 -R var/ generated/ pub/static/ pub/media/

and after installing it may require permission for env.php file:

chmod 777 app/etc/env.php

Take help from Magento DevDocs for user required permissions :

https://devdocs.magento.com/cloud/before/before-workspace-file-sys-owner.html 

and for files and folders :

https://devdocs.magento.com/guides/v2.4/install-gde/prereq/file-sys-perms-over.html 

 

Hope it helps to resolve your query.

 

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

View solution in original post

Re: Set the minimum of the folder/file permissions to an user to install and custmize extentions

@nmicro70gm7302 

 

No need to rollback anything, the folders and files should have these permission only, and the reason behind to set 777 for :

var : it stores cache files, logs etc which are generated for faster delivery and it is being created from Magento system so without this permission they can't be created.

generated : this stores all the classes from all the modules which Magento has, so this also needs to be open for permission so Magento can modify/create files inside this folder.

pub/static & pub/media : these are the files which will bring your styles/media files/script files on frontend so these are also being used by system to manipulate data inside them.

There is no harm with these permission, this is default of Magento.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

View solution in original post

4 REPLIES 4

Re: Set the minimum of the folder/file permissions to an user to install and custmize extentions

Hello @nmicro70gm7302 

 

You need to set 775 for folders and subfolders and 664 for all type of files, and you should give 777 permission to var/ generated/ pub/static/ pub/media/

so you must run below commands to set permissions : 

find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento
chmod 777 -R var/ generated/ pub/static/ pub/media/

and after installing it may require permission for env.php file:

chmod 777 app/etc/env.php

Take help from Magento DevDocs for user required permissions :

https://devdocs.magento.com/cloud/before/before-workspace-file-sys-owner.html 

and for files and folders :

https://devdocs.magento.com/guides/v2.4/install-gde/prereq/file-sys-perms-over.html 

 

Hope it helps to resolve your query.

 

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Set the minimum of the folder/file permissions to an user to install and custmize extentions

Hello, 

 

Thanks alot for your help and your answer.

 

Do i need to switch back the permissions after the extension instllation?

If yes, please command line to do that. 

 

Becuase i think the others users will have more permissions if i set 777 to var/ generated/ pub/static/ pub/media/  and  app/etc/env.php

 

 

 

 

Re: Set the minimum of the folder/file permissions to an user to install and custmize extentions

@nmicro70gm7302 

 

No need to rollback anything, the folders and files should have these permission only, and the reason behind to set 777 for :

var : it stores cache files, logs etc which are generated for faster delivery and it is being created from Magento system so without this permission they can't be created.

generated : this stores all the classes from all the modules which Magento has, so this also needs to be open for permission so Magento can modify/create files inside this folder.

pub/static & pub/media : these are the files which will bring your styles/media files/script files on frontend so these are also being used by system to manipulate data inside them.

There is no harm with these permission, this is default of Magento.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Set the minimum of the folder/file permissions to an user to install and custmize extentions

Thanks a lot.