0

I can't able to remove var/cache folder. I'm using local server and accessed through ssh. How can I remove the var/cache folder by setting permission?

I have run chmod 755 -R var/* and getting the below error:

chmod: changing permissions of 'var/cache/mage--6': Operation not permitted
chmod: changing permissions of 'var/cache/mage--6/mage---4c4_SYSTEM_WEBSITES_1': Operation not permitted
chmod: changing permissions of 'var/cache/mage--6/mage---4c4_CORE_CACHE_INVALIDATE': Operation not permitted
chmod: changing permissions of 'var/cache/mage--5': Operation not permitted
chmod: changing permissions of 'var/cache/mage--5/mage---4c4_GLOBAL__DICONFIG': Operation not permitted
chmod: changing permissions of 'var/cache/mage--5/mage---4c4_EXTENSION_ATTRIBUTES_CONFIG': Operation not permitted
chmod: changing permissions of 'var/cache/mage--7': Operation not permitted
chmod: changing permissions of 'var/cache/mage--7/mage---4c4_SYSTEM_STORES_1': Operation not permitted
chmod: changing permissions of 'var/cache/mage--7/mage---4c4_INTERCEPTION': Operation not permitted
chmod: changing permissions of 'var/cache/mage--8': Operation not permitted
chmod: changing permissions of 'var/cache/mage--8/mage---4c4_INITIAL_CONFIG': Operation not permitted
chmod: changing permissions of 'var/cache/mage--8/mage---4c4_GLOBAL__EVENT_CONFIG_CACHE': Operation not permitted
chmod: changing permissions of 'var/cache/mage--0': Operation not permitted
chmod: changing permissions of 'var/cache/mage--0/mage---4c4_CRON_GROUPS_CONFIG_CACHE': Operation not permitted
chmod: changing permissions of 'var/cache/mage--3': Operation not permitted
chmod: changing permissions of 'var/cache/mage--3/mage---4c4_SYSTEM_WEBSITES_ADMIN': Operation not permitted
chmod: changing permissions of 'var/cache/mage--a': Operation not permitted
chmod: changing permissions of 'var/cache/mage--a/mage---4c4_GLOBAL_PRIMARY_PLUGIN_LIST': Operation not permitted
chmod: changing permissions of 'var/cache/mage--1': Operation not permitted
chmod: changing permissions of 'var/cache/mage--1/mage---4c4_SYSTEM_STORES_ADMIN': Operation not permitted
chmod: changing permissions of 'var/cache/mage--9': Operation not permitted
chmod: changing permissions of 'var/cache/mage--9/mage---4c4_SYSTEM_WEBSITES_0': Operation not permitted
chmod: changing permissions of 'var/cache/mage--e': Operation not permitted
chmod: changing permissions of 'var/cache/mage--e/mage---4c4_SYSTEM_STORES_0': Operation not permitted
chmod: changing permissions of 'var/cache/mage--4': Operation not permitted
chmod: changing permissions of 'var/cache/mage--4/mage---4c4_DICONFIGF43A730BCC60DA5CA955D2AF4C707B0D': Operation not permitted
chmod: changing permissions of 'var/cache/mage--d': Operation not permitted
chmod: changing permissions of 'var/cache/mage--d/mage---4c4_SYSTEM_STORES_DEFAULT': Operation not permitted
chmod: changing permissions of 'var/cache/mage--f': Operation not permitted
chmod: changing permissions of 'var/cache/mage--f/mage---4c4_SYSTEM_SCOPES': Operation not permitted
chmod: changing permissions of 'var/cache/mage--c': Operation not permitted
chmod: changing permissions of 'var/cache/mage--c/mage---4c4_SYSTEM_WEBSITES_BASE': Operation not permitted
chmod: changing permissions of 'var/cache/mage--b': Operation not permitted
chmod: changing permissions of 'var/cache/mage--b/mage---4c4_SYSTEM_DEFAULT': Operation not permitted
chmod: changing permissions of 'var/cache/mage--b/mage---4c4_SYSTEM': Operation not permitted
chmod: changing permissions of 'var/composer_home': Operation not permitted
chmod: changing permissions of 'var/composer_home/.htaccess': Operation not permitted
chmod: changing permissions of 'var/composer_home/cache': Operation not permitted
chmod: changing permissions of 'var/composer_home/cache/files': Operation not permitted
chmod: changing permissions of 'var/composer_home/cache/repo': Operation not permitted
chmod: changing permissions of 'var/composer_home/cache/repo/https---repo.packagist.org': Operation not permitted
chmod: changing permissions of 'var/composer_home/cache/repo/https---repo.magento.com': Operation not permitted
chmod: changing permissions of 'var/composer_home/cache/.htaccess': Operation not permitted
chmod: changing permissions of 'var/debug': Operation not permitted
chmod: changing permissions of 'var/debug/db.log': Operation not permitted
chmod: changing permissions of 'var/log': Operation not permitted
chmod: changing permissions of 'var/log/system.log': Operation not permitted
chmod: changing permissions of 'var/resource_config.json': Operation not permitted
  1. OS: Ubuntu/Linux
  2. Magento Version: 2.3.2
1
  • try with sudo chmod -R 777 var/ pub/ Commented Aug 9, 2019 at 11:02

3 Answers 3

3

Run this command:

chmod -R 777 var/*
1

Try to run below command

sudo chmod -R 777 var/
sudo rm -rf var/cache
5
  • I have run this command and got "xyz is not in the sudoers file. This incident will be reported."
    – Siva
    Commented Aug 9, 2019 at 10:59
  • try run command with root user or the user which have permissions
    – ASQ
    Commented Aug 9, 2019 at 11:00
  • Also share your error screenshot
    – ASQ
    Commented Aug 9, 2019 at 11:01
  • this command not for change permission. Commented Aug 9, 2019 at 11:02
  • see updated answer
    – ASQ
    Commented Aug 9, 2019 at 11:02
1

Run this command

chown -f owner:group var/

Your Answer

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

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