当前位置: 首页 > news >正文

Ubuntu取消开机用户自动登录


注:配置前请先设置登录密码,不同显示管理器配置方法不同,可用命令查看:cat /etc/X11/default-display-manager


一、LightDM 显示管理器,关闭 Ubuntu 系统用户自动登录


  1. 查找自动登录配置文件,可以看到类似 autologin.conf 的文件
find / -iname "*autologin.conf*"/etc/lightdm/lightdm.conf.d/20-autologin.conf
  1. 找到文件中以下几行,将 autologin-user=teamhd 改为 autologin-user= 然后重启验证
[Seat:*]
user-session=Lubuntu
autologin-user=
  1. 可用 sed 命令一键配置,然后重启验证
关闭:sudo sed -i 's/^autologin-user=teamhd/autologin-user=/' /etc/lightdm/lightdm.conf.d/20-autologin.conf开启:sudo sed -i 's/^autologin-user=/autologin-user=teamhd/' /etc/lightdm/lightdm.conf.d/20-autologin.confsudo systemctl restart lightdm

二、GDM 显示管理器,关闭 Ubuntu 系统用户自动登录


  1. 查找自动登录配置文件,可以看到类似于以下名称的文件
find / -iname "*custom.conf*"/etc/gdm3/custom.conf
  1. 找到文件中以下几行,将 AutomaticLoginEnable = true 改为 false 然后重启验证
[daemon]
AutomaticLoginEnable = false
AutomaticLogin = teamhd
  1. 可用 sed 命令一键配置,然后重启验证
关闭:sudo sed -i 's/^AutomaticLoginEnable *= *true/AutomaticLoginEnable=false/' /etc/gdm3/custom.conf开启:sudo sed -i 's/^AutomaticLoginEnable *= *false/AutomaticLoginEnable=true/' /etc/gdm3/custom.confsudo systemctl restart gdm

三、特殊情况(没有自动登录配置文件)


  1. 如果没找到类似文件名的配置文件,则手动创建并添加内容,例如 20-autologin.conf
sudo vim /etc/lightdm/lightdm.conf.d/20-autologin.conf
  1. 在文件中添加以下内容来关闭自动登录,然后重启验证
[Seat:*]
autologin-user=
  1. 在文件中添加以下内容来开启自动登录,然后重启验证
[Seat:*]
autologin-user=teamhd

相关文章:

  • Practice 2025.6.1—— 二叉树进阶面试题(2)
  • Python爬虫:AutoScraper 库详细使用大全(一个智能、自动、轻量级的网络爬虫)
  • GNSS终端授时之四:高精度的PTP授时
  • JDBC连不上mysql:Unable to load authentication plugin ‘caching_sha2_password‘.
  • 通俗易懂的 JS DOM 操作指南:从创建到挂载
  • uniapp uni-id 如果是正式项目,需自行实现发送邮件的相关功能
  • 【Java基础】Java基础语法到高级特性
  • WEBSTORM前端 —— 第3章:移动 Web —— 第5节:响应式网页
  • Python 训练营打卡 Day 41
  • 船舶二阶非线性响应方程的EKF与UKF参数辨识
  • 使用BERT/BiLSTM + CRF 模型进行NER进展记录~
  • PyTorch ——torchvision数据集使用
  • 缓存击穿、缓存雪崩、缓存穿透以及数据库缓存双写不一致问题
  • 落石石头检测数据集VOC+YOLO格式1185张1类别
  • 【MySQL】第13节|MySQL 中模糊查询的全面总结
  • Mixly1.0/2.0/3.0 (windows系统) 安装教程及使用常见问题解决
  • leetcode179_最大数
  • 从认识AI开始-----Transformer:大模型的核心架构
  • 湖北理元理律师事务所:企业债务优化的科学路径与人文关怀
  • LLaMA-Factory - 批量推理(inference)的脚本
  • 做淘客网站用什么程序/反向链接查询
  • 企石网站建设/公众号怎么做文章推广
  • 商城网站建设自助建站平台/百度百度一下一下
  • 寄生虫网站怎么做/自动优化app
  • 建网站商城/国内做网站比较好的公司
  • 可以建网站的路由器/重庆网站网络推广