1.查看当前启动模式[root@dbserver ~]#** systemctl get-default**graphical.target[root@dbserver ~]#
2.设置为字符界面启动系统[root@dbserver ~]# systemctl set-default multi-user.targetrm '/etc/systemd/system/default.target'ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'[root@dbserver ~]#
3.查看更改后的启动模式[root@dbserver ~]#** systemctl get-default**multi-user.target[root@dbserver ~]#
4.重启系统[root@dbserver ~]# reboot
5.改回原来的启动模式[root@dbserver ~]#** systemctl set-default graphical.target**rm '/etc/systemd/system/default.target'ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'[root@dbserver ~]#6.如果在字符界面想切换到图形界面可以执行以下操作[root@dbserver ~]#startx
操作系统开机自动登录桌面
Ubuntu 系统下设置1、 允许使用root用户登录桌面Ubuntu默认不允许使用root用户登录桌面的,首先需要进行如下配置编辑/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf将该文件的配置修改成如下[Seat:*]user-session=ubuntugreeter-show-manual-login=true #在登录时允许用户自己输入用户名和密码Ubuntu中的root用户默认是没有设置密码的,所以还需要设置root密码sudo passwd root#在当前桌面登录的用户下执行这条命令修改root密码[sudo] user 的密码:#输入当前登录用户用户user的密码输入新的 UNIX 密码:#输入给root密码重新输入新的 UNIX 密码: #再次输入root密码passwd:已成功更新密码
2、 允许root开机自动登录桌面再次编辑/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf,在该文件末尾添加如下两行
allow-guset=flase #禁止访客用户登录Autologin-user=root #指定root为自动登录用户编辑完成之后,还需要修改图形桌面配置,编辑文件/etc/gdm3/custom.conf,找到[daemon]项,将该项的配置修改至如下
[daemon]AutomaticLoginEnable=true #启用自动登录AutomaticLogin=root#指定root用户为自动登录用户
3、 由于Ubuntu默认是禁止使用root用户进行ssh远程登录终端访问的,所以如果需要使用root登录ssh的话则需要再文件中增加如下配置PermitRootLogin yes
4、 重启电脑生效
RHEL7系统下设置相比与于Ubuntu系统修改linux开机启动权限linux入门linux社区,Redhat的设置就比较简单了修改linux开机启动权限,只需要修改/etc/gdm/custom.conf文件的[daemon]项配置,重启后即可生效[daemon]AutomaticLoginEnable=TrueAutomaticLogin=root
修改如下:
GDM configuration storage
[daemon]AutomaticLoginEnable=TrueAutomaticLogin=root
[security]
[xdmcp]
[chooser]
[debug]
Uncomment the line below to turn on debugging
#Enable=true