cancel
Showing results for 
Search instead for 
Did you mean: 

permission denied with chmod and var/cache commands

SOLVED

permission denied with chmod and var/cache commands

upgrading from magento 2.3.3 to 2.4

 

In cpanel > terminal, permission denied when running these commands

rm -rf var/cache/* var/view_preprocessed/*  var/page_cache/* var/session/* pub/static/*

chmod -R 0777 var/* pub/* generated/*

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: permission denied with chmod and var/cache commands

@Sheba 

 

The best way is to change the ownership of project to the user you're using for ssh, then you won't face the above error.

sudo chown -R africloset:africloset projectfolder/

after changing permission you'll be able to run without sudo.

 

or if there are multiple users working, then create a new common user and change ownership for that common user and ask dev's to use that user.

 

Hope it helps !

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

View solution in original post

4 REPLIES 4

Re: permission denied with chmod and var/cache commands

Hello @Sheba 

 

It's related with the user you are using to run commands, the user doesn't have enough permissions to perform these actions, you might be able to run it with sudo, just append sudo before commands like below:

sudo rm -rf var/cache/* var/view_preprocessed/* var/page_cache/* var/session/* pub/static/*

sudo chmod -R 0777 var/* pub/* generated/*

Hope it helps !

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

Re: permission denied with chmod and var/cache commands

Thanks Gaurav for your suggestion.  Am I executing the sudo in each site's public_html directories?

 

How do I set the permissions in webroot?  So each programmer does not have to use sudo.

 

Thanks again.

Re: permission denied with chmod and var/cache commands

@Sheba 

 

The best way is to change the ownership of project to the user you're using for ssh, then you won't face the above error.

sudo chown -R africloset:africloset projectfolder/

after changing permission you'll be able to run without sudo.

 

or if there are multiple users working, then create a new common user and change ownership for that common user and ask dev's to use that user.

 

Hope it helps !

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

Re: permission denied with chmod and var/cache commands

Thanks again, now the issue is permission denied when running this command

 /opt/cpanel/ea-php74/root/bin/php bin/magento setup:upgrade