# [LightDM Design](https://www.freedesktop.org/wiki/Software/LightDM/Design/) ## 什么是DM? DM(显示管理器)功能如下: * 启动和管理本地实例化的X Server; * 用户认证; * 启动和管理用户回话(常用情景); * 在boot过程中,单例启动X 服务器和开始一个用户会话((kiosk mode)); * 在boot过程中,单例启动 X服务器,显示用户登录界面,在连接时启动用户会话; * 支持多用户同时登录,用户选择具体用户登录,同时为每一个 用户启动 X 服务器; * 允许 X 服务器,使用XDMCP,运行瘦客户端远程连接到其他X 服务器。 ## 设计目标 * 快速 不增加其他额外的启动时间; * 异常安全 处理所有 ## Definitions - Display Manager - A daemon that manages the displays on a system. - Display - A combination of an X server, greeter and a user session. - User session - An application that runs on a display and allows the user to run applications. - Greeter - An application to run on a display and prompt for authentication and session options. ## Requirements Daemon: - Able to run as as system service without user interaction - Provide logging information for debugging - Launch and monitor X servers - Launch and monitor greeter applications for displays without a user session - Launch and monitor user sessions after user is authenticated - Authenticate users - Provide an interface to greeter applications - Provide an interface to user switchers - Store a database of active displays - Load sessions from /usr/share/xsessions - Store session configuration in ~/.dmrc - Support .dmrc not being readable before login - Advertise display database to [Software/ConsoleKit](https://www.freedesktop.org/wiki/Software/ConsoleKit/) if available - Use PAM for authentication Session environment: - Set USER to the username - Set HOME to users home directory - Set SHELL to the users shell - Set PATH to /usr/bin:/bin - Set LANG to the users language - Set DISPLAY to the X servers address - Set environment variables from /etc/environment Static Display Module: - Allow 0-N displays to be enabled at all time - Support automatic/timed login User Switcher Module: - Interface to switch to existing local display for a logged in user - Start new static display if user not logged in XDMCP Server Module: - Implement XDMCP protocol Module interface: - Expose display database Greeter application/interface: - User authentication - Session choice - Session language - Session keyboard layout - Logged in users ## Implementation Daemon: - Implemented in C+GObject - Single process Greeter Interface: - D-Bus GTK+ Greeter: ## Inter-process Relationships ![](http://www.leconiot.com/md_res/jaysnote/lightdm/images/LightDM_interprocess_relationships.png)