【SELinux】教程文章相关的互联网学习教程文章

SELinux导致PHP连接MySQL异常Can'tconnecttoMySQLserver的解

同事报告一起奇怪的现象,一个最简单的测试PHP代码,在测试环境很正常,但是在正式环境下,无论用何种方式(tcp/ip、unix socket)都无法连接mysql。 我协助查看了下,确实如此,无论是指定IP、端口的tcp/ip方式连接,或者是用unix socket方式连接,报错信息都同事报告一起奇怪的现象,一个最简单的测试PHP代码,在测试环境很正常,但是在正式环境下,无论用何种方式(tcp/ip、unix socket)都无法连接mysql。 我协助查看了下,确实如此...

检查selinux状态的方法

检查selinux状态的方法: 来源于: How to Check whether SELinux is Enabled or Disabled (文档 ID 432988.1) selinux 有3种模式: Enforcing (or known as enabled), Disabled or Permissive. Permissive mode loads the SELinux software, but doesnt enf检查selinux状态的方法: 来源于: How to Check whether SELinux is Enabled or Disabled (文档 ID 432988.1) selinux 有3种模式: Enforcing (or known as enabled), Disa...

rhel5下禁用SElinux的方法

rhel 5下禁用SElinux的方法: Edit /etc/selinux/config Change the SELINUX value to SELINUX=disabled. Reboot the server. 在RHEL5.8 的 文本安装【本文来自鸿网互联 (http://www.68idc.cn)】过程中,是没有关于selinux的设置的,因此在一个人安装os后,rhel 5下禁用SElinux的方法: Edit /etc/selinux/config Change the SELINUX value to "SELINUX=disabled". Reboot the server. 在RHEL5.8 的 文本安装【本文来自鸿网互联 (h...

SELinux导致PHP连接MySQL异常Can'tconnecttoMySQLserver的解决方法_MySQL

同事报告一起奇怪的现象,一个最简单的测试PHP代码,在测试环境很正常,但是在正式环境下,无论用何种方式(tcp/ip、unix socket)都无法连接mysql。 我协助查看了下,确实如此,无论是指定IP、端口的tcp/ip方式连接,或者是用unix socket方式连接,报错信息都类似:代码如下:Could not connect: Cant connect to MySQL server on MYSQL.SERVER (13) 无论如何修改MySQL的授权,或者调整php.ini中关于MySQL的设置,或者修改MySQL的监听...

selinux干扰mysql启动

[root@echoyang5 mysql_xinchao]# /etc/init.d/mysqld start /usr/bin/mysqld_safe: line 549: /data/mysql_xinchao/mysqld_safe.pid: Permission denied awk: (FILENAME=- FNR=1) warning: error writing standard output (Broken pipe) MySQL Daemon failed to start. Starting mysqld: [FAILED] 我用/usr/bin/mysqld_safe都能启动,但就是没法用/etc/init.d/mysqld start 启动mysql 折腾了两天,是因为selinux没有关闭导致的。 ...

centos – 即使在VM上为SELinux设置安全上下文后,MySQL权限也被拒绝错误【代码】

我在CentOS上安装了MySQL(详细版本如下).我的操作系统是VM机器而不是物理机器,目录/ data / mysql是本地磁盘(虚拟).我怀疑我可能需要在虚拟化环境中做一些额外的步骤.这link has some information on SELinux & virtualization但不确定如何将其包含在MySQL中. MySQL可以正常使用/ var / lib / mysql中的数据目录,但是当我将它移动到不同磁盘上的另一个目录时,它就会停止工作.而同一磁盘上的不同目录有效.如果我禁用SELinux,MySQL可...

shell – Selinux拒绝访问mysqld【代码】

我有一个转储mysql数据库的脚本.然后它压缩文件,并使用cron将其存储在我的主文件夹中.问题是我似乎收到了错误消息.mysqldump: Couldn’t execute ‘show fields from `auth_group`’: Can’t create/write to file ‘/tmp/#sql_151e_0.MYI’ (Errcode: 13) (1)c2duo_db-22072011.sql现在在我的centos服务器图形端,它说selinx拒绝访问mysqld.当然,如果我禁用selinux,这工作正常.但我需要启用selinux.有没有解决这个问题的方法? cro...

InnoDB:在更改/ var / lib / mysql /中的权限或禁用selinux后,文件操作中的操作系统错误号13未修复【代码】

当我运行mysql时,我得到ERROR 2002(HY000)的错误:无法通过套接字’/var/run/mysqld/mysqld.sock(2)连接到本地MySQL服务器. mysqld给出了错误150101 12:08:19 [Warning] Can't create test file /var/lib/mysql/lamp-update.lower-test150101 12:08:19 [Warning] Can't create test file /var/lib/mysql/lamp-update.lower-test150101 12:08:19 [Warning] One can only use the --user switch if running as root150101 12:08:19 [...

Linux下开启SELinux后ssh不能正常启动原因

查看/var/log/secure档案后发现端口绑定失败,测试后发现ssh只能绑定到22号端口,否则会被SELinux拒绝,使服务完全不能启动。解决方法:[root@RayServer ~]# vim /etc/ssh/sshd_config找到port项,设置端口为22再让防火墙放行该端口[root@RayServer ~]# vim /etc/sysconfig/iptables在适当位置添加该行即可-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT最后重启ssh服务即可/etc/init.d/sshd restart检查SELin...

Linux临时关闭和永久关闭SELinux【代码】

查看SELinux状态:[root@localhost ~]# getenforceEnforcing临时关闭SELinux:[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive永久关闭SELinux:在 /etc/sysconfig/ 目录下修改配置文件 selinux[root@localhost ~]# vim /etc/sysconfig/selinux配置文件内容:# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security ...

如何使用semanage管理SELinux安全策略【图】

Centos7.7操作系统Selinux已经开启开启方式:[root@localhost?~]#?sed?-i?'/^SELINUX/s/disabled/enforcing/g'?/etc/selinux/config#?然后重启一下操作系统[root@localhost?~]#?reboot#?重启完成之后检查一下是否是enforcing模式[root@localhost?~]#?getenforceEnforcing常用参数port: 管理定义的网络端口类型fcontext: 管理定义的文件上下文-l: 列出所有记录-a: 添加记录-m: 修改记录-d: 删除记录-t: 添加的类型-p: 指定添加的端口...

安装docker出现错误:需要:container-selinux >= 22.74【代码】【图】

安装docker出现错误:需要:container-selinux >= 2:2.74 报错信息解决办法 根据信息判断是container-selinux版本过低或者未安装,导致不支持,于是 先运行以下命令,下载和自己操作系统版本对应的yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 新yum包索引,建立缓存 yum makecache fast 最后重新安装验证 yum install docker-ce -y

CentOS7_SELinux_firewalld【代码】

关闭SELinux 查看 # getenforce Disabled [# /usr/sbin/sestatus -v SELinux status: disabled临时关闭 ##设置SELinux 成为permissive模式 ##setenforce 1 设置SELinux 成为enforcing模式 setenforce 0永久关闭 vi /etc/selinux/config将SELINUX=enforcing改为SELINUX=disabled 设置后需要重启才能生效 关闭防火墙 查看防火墙状态: systemctl status firewalld.service 绿的running表示防火墙开启 执行关闭命令:...

CentOS7的防火墙以及selinux介绍【代码】

简介:firewall防火墙的使用 防火墙:主要用户信息安全防护,主要有软件防火墙和硬件防火墙。firewalld防火墙是软件防火墙 在centos7 之前默认采用的防火墙是iptables,而在centos 7则是采用firewall 查看firewalld服务状态 systecmctl status firewalld 开启、重启、关闭firewalld服务 开启:systemctl start firewalld.service 关闭:systemctl stop firewalld.service 重启:systemctl restart firewalld.service 查看firewall防...

SELinux 入门详解【代码】【图】

一、前言 安全增强型 Linux(Security-Enhanced Linux)简称 SELinux,它是一个 Linux 内核模块,也是 Linux 的一个安全子系统。 SELinux 主要由美国国家安全局开发。2.6 及以上版本的 Linux 内核都已经集成了 SELinux 模块。 SELinux 的结构及配置非常复杂,而且有大量概念性的东西,要学精难度较大。很多 Linux 系统管理员嫌麻烦都把 SELinux 关闭了。 如果可以熟练掌握 SELinux 并正确运用,我觉得整个系统基本上可以到达“坚不...