今天在装某个软件的时候,修改了selinux参数。修改selinux 的某个参数值为Disable。导致 linux系统不能启动。出现如下错误 Kernel panic -not syncing:Attempted to kill init!
后经过向群友请教和自己操作和互联网搜索,终于找到了解决办法。
在linux启动界面出现时,按f2进入如下界面:
按e进入如下界面
移动到第2个选项,再按e进入编辑
在后面输入 selinux=0
按回车。
返回到原来界面,
再按b,就可以启动了。
以下为转载自:
http://tech.srcsky.com/os/linux/349502.html
SELINUX从理解到动手配置。
SELinux 可以为你的系统提供较棒的安全防护。 使用者能被分配预先定义好的角色,以便他们不能存取文件或者访问他们不拥有的程序。
Selinux的启用与关闭
编辑/etc/selinux/conf文件
SELINUX=enforcing(强制:违反了策略,你就无法继续操作下去)
Permissive(有效,但不强制:违反了策略的话它让你继续操作,但是把你的违反的内容记录下来)
Disabled(禁用)
禁用的另一种方式:在启动的时候,也可以通过传递参数selinux给内核来控制它
编辑/etc/grup.conf
title Red Hat Enterprise Linux Server (2.6.18-8.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet selinux=0
initrd /initrd-2.6.18-8.el5.img
SELINUXTYPE=targeted
此参数可选项:targeted和strice。分别是targeted只控制关键网络服务,strice控制所有的服务
查询selinux的状态
[root@linuxas ~]# /usr/sbin/getenforce
Enforcing
[root@linuxas ~]# sestatus -bv
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted
查看selinux加载的内核模块
[root@linuxas selinux]# semodule -l
amavis 1.1.0
ccs 1.0.0
clamav 1.1.0
dcc 1.1.0
evolution 1.1.0
iscsid 1.0.0
mozilla 1.1.0
mplayer 1.1.0
nagios 1.1.0
oddjob 1.0.1
pcscd 1.0.0
pyzor 1.1.0
razor 1.1.0
ricci 1.0.0
smartmon 1.1.0
查看selinux错误日志
[root@linuxas selinux]# sealert -a /var/log/audit/audit.log
SElinux的图形化管理工具
[root@linuxas selinux]# system-config-selinux
Selinux的基本操作
查看文件:ls –Z(--context)
[root@linuxas ~]# ls -Z
drwx------ root root root:object_r:user_home_t Desktop
-rw------- root root system_u:object_r:user_home_t anaconda-ks.cfg
-rw-r--r-- root root root:object_r:user_home_t install.log
-rw-r--r-- root root root:object_r:user_home_t install.log.syslog
[root@linuxas ~]# ls --context
drwx------ root root root:object_r:user_home_t Desktop
-rw------- root root system_u:object_r:user_home_t anaconda-ks.cfg
-rw-r--r-- root root root:object_r:user_home_t install.log
-rw-r--r-- root root root:object_r:user_home_t install.log.syslog
查看文件系统的扩展属性:getfattr
[root@linuxas ~]# getfattr -m. -d /etc/passwd
getfattr: Removing leading '/' from absolute path names
# file: etc/passwd
security.selinux="system_u:object_r:etc_t:s0\000"
查看的文件的 security.selinux 属性中储存了此文件的安全上下文, 所以上面例子中的上下文就是 system_ubject_r:etc_t 。
所有运行了SE Linux的ext2/3文件系统上都有 security.selinux 这个属性。
更改文件的扩展属性标签:chcon (不能在 /proc 文件系统上使用,就是说 /proc 文件系统不支持这种标记的改变。)
[root@linuxas test]# ls --context aa.txt
-rw-r--r-- root root root:object_r:user_home_t aa.txt
[root@linuxas test]# chcon -t etc_t aa.txt
[root@linuxas test]# ls --context aa.txt
-rw-r--r-- root root root:object_r:etc_t aa.txt
恢复原来的文件标签: restorecon
[root@linuxas test]# restorecon aa.txt
[root@linuxas test]# ls -Z aa.txt
-rw-r--r-- root root user_u:object_r:user_home_t aa.txt
显示当前用户的Selinux context
[root@linuxas ~]# id -Z
root:system_r:unconfined_t:SystemLow-SystemHigh
runcon 使用特定的context来执行指令
[root@linuxas ~]# runcon -t user_home_t cat /etc/passwd
root:system_r:user_home_t:SystemLow-SystemHigh is not a valid context
查看某种服务是否受到SELinux的保护
[root@linuxas ~]# getsebool -a (RHEL4:inactive受保护,active不受保护;RHEL5:off受保护,on不受保护)
分享到:
相关推荐
kernel panic - not syncing : fatal exception 之后就一直停在那里. 查了一些网站资料,大部分都是双CPU才发生的,有些是关闭:Hyper-Threading (HT)好了,有些关闭USB好了。 但是我试过了关闭HT,或者关闭USB都...
解决container-selinux >= 2:2.74,它被软件包 3:docker-ce-19.03.5-3.el7.x86_64 需要问题.container-selinux-2.74-1.el7.noarch.rpm
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
docker 离线安装依赖的基础包。
离线安装包,亲测可用
SELinux by example is the first complete, hands-on guide to using SELinux in production environments. Authored by three leading SELinux researchers and developers, it illuminates every facet of ...
# SELinux is unsed in CaaSP rule: 'RunAsAny' --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: name: flannel rules: - apiGroups: ['extensions'] resources: ['pod...
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
Android 系统 Linux系统 内核kernel启动流程 init 进程介绍,init进程初始化,内核启动三个阶段深入浅出介绍,简单易懂 。kernel_init() 函数介绍,ramdisk_execute_command,execute_command /sbin/init,/etc/init,...
centos系统安装docker时常缺此安装包, 下载rpm安装包后执行命令: rpm -i container-selinux-2.9-4.el7.noarch.rpm 即可完成安装,再继续docker其他安装。
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
在centos安装docker报错,需要相关依赖包 ... Requires: container-selinux >= 2.9 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
container-selinux-2.107-3.el7.noarch.rpm