RHEL6操作系统

7个运行级别:

init 0 -6

init 0 关机

init 1 单用户模式

init 2 多用户状态,没有网络服务

init 3 字符界面

init 4 系统未使用保留给用户

init 5 图形界面

init 6 系统重启

设置默认启动级别:

[root@localhost ~]# vim /etc/inittab

可修改id:3:initdefault: 这一行中的数字

RHEL7操作系统

切换到第3运行级别:

[root@localhost ~]# systemctl isolate multi-user.target 或者使用软链接

[root@localhost ~]# systemctl isolate runlevel3.target

切换到第5运行级别

[root@localhost ~]# systemctl isolate graphical.target 或者使用软链接

[root@localhost ~]# systemctl isolate runlevel5.target

设置默认的运行级别:

方法一: 在创建新链接前,先删除存在的链接

[root@localhost ~]# rm -rf /etc/systemd/system/default.target

默认启动级别

[root@localhost ~]# ln -sf /lib/systemd/system/multi-user.target(graphical.target) /etc/systemd/system/default.target

方法二:[root@localhost ~]# systemctl -f enable multi-user.target(graphical.target)

查看当前运行级别:runlevel

Passwd l 锁定用户

Passwd L 锁定用户