selinux

查看 SELinux状态及关闭SELinux

社会主义新天地 提交于 2019-12-07 18:52:38
查看SELinux状态: 1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态 SELinux status: enabled 2、getenforce ##也可以用这个命令检查 关闭SELinux: 1、临时关闭(不用重启机器): setenforce 0 ##设置SELinux 成为permissive模式 ##setenforce 1 设置SELinux 成为enforcing模式 2、修改配置文件需要重启机器: 修改/etc/selinux/config 文件 将SELINUX=enforcing改为SELINUX=disabled 重启机器即可 来源: oschina 链接: https://my.oschina.net/u/122166/blog/337789

CentOS 永久关闭SELinux

余生长醉 提交于 2019-12-07 18:49:52
CentOS 永久关闭SELinux [root @lujie ~]# 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 policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. #SELINUX=enforcing # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected , # mls - Multi Level Security protection. #SELINUXTYPE=targeted 设置方法: 1 #SELINUX=enforcing #注释掉 2 #SELINUXTYPE=targeted #注释掉 3 SELINUX=disabled #增加 4 :wq #保存,关闭。

fedora15 下安装google chrome 提示"AVC 拒绝“问题的解决

◇◆丶佛笑我妖孽 提交于 2019-12-07 14:15:00
安装chrome时,若用普通用户登录,可能由于权限问题,chrome不能访问根目录下的一些文件,selinux会提示avc拒绝,于是我吧selinux关掉(网上说关掉selinux安全性降低到windows级别。。。) 关掉selinux步骤: vi /etc/selinux/config 把其中一行SELINUX=enforcing改成disabled就行了,重启就可以用chrome了,感觉比firefox好很多(我系统原装的firefox还要自己安装flashplayer等插件,对于linux粗学者不大友好) 如果提示“ Failed dependencies: lsb needed" 可以 装一下lsb:"yum install lsb*" 或直接yum install google-chrome*解决所有包依赖问题 之前我还试过用 root登录图形界面 ,方法是把 /etc/pam.d/ 中的gdm 和 gdm-password 中的 “ auth required pam_succeed_if.so user != root quiet ” 一句注释掉,重启后选择用户others 输入root 和passwd就能到root的图形界面,但问题有来了,启动chrome时提示root 没有自己的 user data 文件夹等等,所以简单的方法还是直接关掉selinux 另外

CentOS 7.6 安装 nginx,配置端口访问网站,切换root目录

好久不见. 提交于 2019-12-07 12:39:38
20190329 CentOS 7.6 安装 nginx,配置端口访问网站 1、查询一下 nginx yum search nginx 已加载插件:fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com epel 12744/12744 ...... ** 如果已经有旧版本,可以重新卸载安装 2、安装 nginx sudo yum install -y nginx 启动并设置为开机启动 基本指令: sudo systemctl start nginx.service sudo systemctl enable nginx.service sudo systemctl status nginx.service sudo systemctl restart nginx.service 查看版本,确认启动 nginx -v nginx version: nginx/1.12.2 ps -ef |grep nginx 测试网站配置 sudo

Centos7 防火墙和Selinux 一些简单操作命令

眉间皱痕 提交于 2019-12-07 12:39:27
CentOS 7 缺省采用了 firewalld ,尽管还是可以安装并支持 iptables,但是还是跟上新东西为好!其实iptables 我也没有用过,哈哈哈! 防火墙功能很强大,但是,日常要做的最多的还是开放端口,记录一下,以便随时 copy 1、 开放 8080 端口 1. 查看防火墙状态 sudo systemctl status firewalld sudo firewall-cmd --state running 2. 防火墙基本命令 # 开启 service firewalld start # 重启 service firewalld restart # 关闭 sudo service firewalld stop # 查看防火墙规则 sudo firewall-cmd --list-all sudo firewall-cmd --state 3. 开启 8080 端口 sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent 重启防火墙 sudo systemctl restart firewalld.service sudo firewall-cmd --reload 4. 不知道为什么,就把自己关在外面了 ssh 连接不上去了! sudo firewall-cmd --list-all

教你玩转Linux系统目录结构

梦想的初衷 提交于 2019-12-07 11:42:26
Linux 内核最初只是由芬兰人林纳斯·托瓦兹(Linus Torvalds)在赫尔辛基大学上学时出于个人爱好而编写的。Linux 是一套免费使用和自由传播的类 Unix 操作系统,是一个基于 POSIX 和 UNIX 的多用户、多任务、支持多线程和多 CPU 的操作系统。Linux 能运行主要的 UNIX 工具软件、应用程序和网络协议。它支持 32 位和 64 位硬件。Linux 继承了 Unix 以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。 教你玩转Linux—系统目录结构教你玩转Linux—系统目录结构 登录系统后,在当前命令窗口下输入 命令 : ls / 你会看到如下图所示: 教你玩转Linux—系统目录结构教你玩转Linux—系统目录结构 树状目录结构: 教你玩转Linux—系统目录结构教你玩转Linux—系统目录结构 以下是对这些目录的解释: /bin: bin是Binary的缩写, 这个目录存放着最经常使用的命令。 /boot: 这里存放的是启动Linux时使用的一些核心文件,包括一些连接文件以及镜像文件。 /dev : dev是Device(设备)的缩写, 该目录下存放的是Linux的外部设备,在Linux中访问设备的方式和访问文件的方式是相同的。 /etc: 这个目录用来存放所有的系统管理所需要的配置文件和子目录。 /home: 用户的主目录

修改Linux SSH的端口与SELinux究竟是什么

淺唱寂寞╮ 提交于 2019-12-07 11:20:29
最近,发现修改ssh端口后,无法启动ssh服务,发现是SELinux限制了这个,此篇文章简单记录下。 SELinux简介 SELinux 主要作用就是最大限度地减小系统中服务进程可访问的资源(最小权限原则)。 SELinux 有三种工作模式,分别是: enforcing:强制模式。违反 SELinux 规则的行为将被阻止并记录到日志中。 permissive:宽容模式。违反 SELinux 规则的行为只会记录到日志中。一般为调试用。 disabled:关闭 SELinux。 SELinux 工作模式可以在 /etc/selinux/config 中设定。 如果想从 disabled 切换到 enforcing 或者 permissive 的话,需要重启系统。反过来也一样。 enforcing 和 permissive 模式可以通过 setenforce 1|0 命令快速切换。 修改ssh端口方法 首先需要关闭SELinux,有两种方法: 修改文件 /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is

ActiveMQ 5.15.x Release安装和配置--Linux篇

五迷三道 提交于 2019-12-07 08:22:50
阅读目录: 1. 关闭防火墙和Selinux 2. 下载并安装ActiveMQ 5.15.x Release版本 3. 启动并验证 4.配置ActiveMQ 5.15.x Release自启动 5.注意事项以及说明 1. 关闭防火墙和Selinux Linux的防火墙是咱们新手的噩梦,很多情况会出现能ping通,但是访问不了Web页面。所以开始就干掉它! 1.1 关闭防火墙 [root@localhost ~]# /etc/init.d/iptables stop iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] 1.2 开机自动关闭防火墙 [root@localhost ~]# chkconfig iptables off 1.3 查看Selinux状态 [root@localhost ~]# sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted

[已解决] apache 虚拟目录403原因

旧巷老猫 提交于 2019-12-07 08:11:42
主要有以下几个原因: 目录权限 这个看apache错误日志,一般会有提示,如: 1475 [Thu Jun 20 16:39:43.673203 2019] [core:crit] [pid 43885] (13)Permission denied: [client 112.93.21.21:14290] AH00529: /home/hello/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/hello/' is executable 需要给目录加上可读可执行权限,如 chmod o+x /home/hello chmod o+r /home/hello Require all denied 设置 如这样配置虚拟目录: Alias /virtualdirectory/ "D:/user/www/virtual/" <Directory "D:/user/www/virtual/"> Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> apache默认配置是比较严格的

关闭selinux而不需重启的方法

眉间皱痕 提交于 2019-12-07 08:11:33
SELinux简介 SELinux全称是Security Enhanced Linux,由美国国家安全部(National Security Agency)对于强 制性访问控制的实现,是linux上最查出的新安全子系统。 应用SELinux后,可以减轻恶意攻击或恶意软件带来的灾难,并提供对机密性和完整性有很高 要求的信息很高的安全保障。 SELinux 是安全加强linux (security enhanced linux). 一个进程能否访问一个文件取决于发起进程的用户和文件的权限。 例如:srvd进程想访问/var/www/html/*中的文件,我们创建的用户aaron此时是否能够访 问/var/www/html/*的文件取决于aaron的权限,我们创建的文件的默认权限是644,目录权限是 755。aaron可以访问fstab passwd部件,如果黑客劫持了srvd进程,就可以访问一些重要文件 了,这是一件非常可怕的事。 再比如用户aa创建了一个文件,想让用户bb访问,怎么办呢?改变其他用户的权限?那么其它 用户也能访问,这并不是我们想要的。在现有模型下,我们很难实现单个用户对单个文件的权限限 制,但是selinux就可以实现这个问题。 SElinux定义了哪些用户可以访问那些文件,它提供了一系列机制,来限制用户权限的访问!