一、通过勾选设定项直接设置
1、打开设置界面。
2、进入详细信息选项。
3、选择用户选项,解锁后将自动登录勾选上即可。
二、通过相应配置文件进行设置
1、gdm3,kdm和lightdm均为display managers。它们提供图形登录并处理用户身份验证。
显示管理器向用户显示登录屏幕。
2、通过命令 cat /etc/X11/default-display-manager 查看当前使用哪个显示管理器
cat /etc/X11/default-display-manager
3、可以使用命令sudo dpkg-reconfigure gdm3/lightdm进行显示管理器的切换
sudo dpkg-reconfigure gdm3
4、自动登录设置
4.1、lightdm下的自动登录设置
系统提供的配置存储在/usr/share/lightdm/lightdm.conf.d/***.conf 中,用户不可编辑。系统管理员可以在/etc/lightdm/lightdm.conf.d/***.conf和/etc/lightdm/lightdm.conf 中覆盖此配置。按上述顺序读取文件并将其组合在一起以进行 LightDM 配置。详细内容可通过https://wiki.ubuntu.com/LightDM查看。
自动登录设置:在 /etc/lightdm/lightdm.conf.d/***.conf 或/etc/lightdm/lightdm.conf 文件中加入下面内容:
[SeatDefaults]
autologin-user=username
其中username为自己的用户名。没有/etc/lightdm/lightdm.conf 文件的话自行创建。
sudo vim /etc/lightdm/lightdm.conf
4.2、 gdm3下的自动登录设置
输入 vim /etc/gdm3/custom.conf 打开配置文件在[daemon]下输入下面内容:
AutomaticLoginEnable=True
AutomaticLogin=username(用户名)
sudo vim /etc/gdm3/custom.conf
AutomaticLoginEnable=True
AutomaticLogin=username
此内容在原始配置中也有,取消注释修改用户名也可。