Trouble Opening a File As The Apache User

Posted on

Trouble Opening a File As The Apache User – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, apache-2.2, permissions, python, .

I am having trouble running a python file as the apache user.

When I run this command: sudo -u apache /etc/httpd/conf.d/upsell_by_id.py I get this error:

File "/etc/httpd/conf.d/upsell_by_id.py", line 8, in <module>
keyword_groups = pickle.load(open("/home/zumodo/upsell_backup/upsells.pkl", "rb" ))
IOError: [Errno 13] Permission denied: '/home/zumodo/upsell_backup/upsells.pkl'

However, the file in question has the following permissions:

-rwxrwxrwx.  1 skline skline 6.4M Dec  5 08:50 upsells.pkl

I am at a loss as to why the apache user is not allowed to open this file.

Solution :

And the dot in the end of the permission list show that you have enabled SELinux extensions. They probably prevent you from reading the file. It could also be that some folders in the file path are not descend-able by the Apache user.

You have to give far more information before you get good answers.

Leave a Reply

Your email address will not be published.