加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

带有SELinux的Python MySQLdb

发布时间:2020-12-14 02:20:58 所属栏目:Linux 来源:网络整理
导读:我在我的 django应用程序中使用mySQLdb模块,该应用程序通过WSGI链接到Apache. 但是我得到了许可问题(如下所示).这取决于SE linux,如果我把它设置为被动,一切都还可以. ImproperlyConfigured: Error loading MySQLdb module: /opt/django/virtenv/django15/li
我在我的 django应用程序中使用mySQLdb模块,该应用程序通过WSGI链接到Apache.
但是我得到了许可问题(如下所示).这取决于SE linux,如果我把它设置为被动,一切都还可以.

ImproperlyConfigured: Error loading MySQLdb module:
/opt/django/virtenv/django15/lib/python2.7/site-packages/_mysql.so:
failed to map segment from shared object: Permission denied

什么是更新SELinux的最佳方式,包括这一点,而不必关闭整个事情.错误如下所示:

ImproperlyConfigured: Error loading MySQLdb module:
/opt/django/virtenv/django1/lib/python2.7/site-packages/_mysql.so:
cfailed to map segment from shared object: Permission denied

解决方法

正如@ Gohn67建议的那样,更改相关文件的SELinux安全上下文,允许HTTPD进程执行它:
sudo chcon -R -h -t httpd_sys_script_exec_t /opt/django/virtenv/django15/lib/python2.7/site-packages/_mysql.so

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读