1

I am using Magento ver 1.9.1.0 and I have log settings enabled in admin panel, but when I delete the existing "log" dir and whenever I call log function like Mage::log(print_r($anyData, true),NULL, 'dataprint.log'); and then when I go to log directory, it shows message "You don't have permissions to view content of this folder" in ubuntu 14.04.

Is this permission/ownership issue ?

Previously this issue wasn't there, also other folders and files permissions are fine but i can't access log without everytime giving command "chmod 777" to var/log directory.

Also if I do not delete "var/log" folder and it's files and just clear out it's files's contents, even then when I try to make new entry into log files(by calling log function) it doesn't allow me too.

Can somebody help me out here ?

  • can you do ls -l and show us the permissions settings for that folder, also do whoami to check which user you are using – lloiacono Jul 28 '15 at 8:01
2

With the latest patch installed, file modes for newly created logs changed to 0640. See SUPEE-6285 broken down by Phillip Jackson.

So this is intended behaviour that you can overcome by e.g. changing modes, groups, or setting up ACL.

  • I checked, it is due to patches indeed, I saw in Mage.php file the permissions are as per patch breakdown, can you guide me on how to override "Mage.php" file ? – H.D. Jul 28 '15 at 9:12
  • No, don't touch this. Just add yourself to the webserver group as proposed by @lloiacono, keep on setting permissions after log creation or set up ACL. – mam08ixo Jul 28 '15 at 12:21
  • Setting permissions immediately after log creation is fine, but how setting ACL is gonna help me as ACL is applied in admin only, please explain in detail. – H.D. Jul 29 '15 at 5:21
  • Sorry, I should have been more precise. I was referring to filesystem ACLs. – mam08ixo Jul 29 '15 at 11:12
0

So you can check the folder permissions for var doing ls -l. There check which user owns the folder (probably www-data), then you can check which user you are currently using doing whoami, and also you can check which id -Gn you user is in by typing groups.

Finally you can add your user to www-data (or to whatever group the user that owns var belongs) like this:

sudo useradd -g www-data yourUser
  • The above command tried to create a user account. Instead I used sudo usermod -G www-data yourUser – Daniel P Apr 11 '17 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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