[root@wen ~]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config #使用sed + i 命令修改
[root@wen ~]# grep "SELINUX=disabled" /etc/selinux/config #grep查看
SELINUX=disabled
[root@wen ~]# cat /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 enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
以上重啟生效,生產環境不能重啟用以下命令不用重啟
[root@wen ~]# getenforce
Enforcing
[root@wen ~]# setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@wen ~]# setenforce 0
[root@wen ~]# getenforce
Permissive
運行級別
[root@wen ~]# cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11 #桌面
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:[root@wen ~]# grep 3:initdefault /etc/inittab #調整運行級別,默認3,可以調成其他
id:3:initdefault:
[root@wen ~]# runlevel #查看當前級別
N 3
[root@wen ~]# init 0 #切換運行級別
View Code
關機
shutdown(halt) init0
參數
-r reboot after shutdown
-h halt or power off after shutdown shutdown -h 10 #10分鐘后關閉
shutdown now #馬上
poweroff #關閉電源*關閉防火墻
[root@wen ~]# /etc/init.d/iptables stop #臨時關閉
iptables:將鏈設置為政策 ACCEPT:filter [確定]
iptables:清除防火墻規則: [確定]
iptables:正在卸載模塊: [確定]
[root@wen ~]# /etc/init.d/iptables status #查看狀態
iptables:未運行防火墻。
[root@wen ~]# /etc/init.d/iptables restart # 重啟防火墻
iptables:應用防火墻規則: [確定]
[root@wen ~]# chkconfig iptables off #開機也不啟動了