红联Linux门户
Linux帮助

CentOS 6.5 GDM非root用户自动登陆

发布时间:2016-12-06 09:45:59来源:linux网站作者:Leekwen
我的测试平台为:
CentOS 6.5 x86 32位 桌面版(GDM)
[root@localhost ~]# cat /etc/issue  
CentOS release 6.5 (Final)  
Kernel \r on an \m  
 
从搜索上搜到的都是修改/etc/gdm/custom.conf文件,如果你按照搜到的去修改(/etc/gdm/custom.conf)的话,重新启动后,普通用户并不能实现自动登陆。
 
经我测试及查看代码发现,CentOS 6.5 并非修改此文件,而是修改/etc/gdm/gdm.schemas 这个文件。
 
我的修改此文件,将普通用户leekwen实现自动登陆,修改后与修改前的对比做出了patch文件。
 
参见patch代码:
[root@localhost ~]# cat /etc/gdm/gdm.patch  
--- gdm.schemas.bak 2016-12-6 9:30:26.047999810 +0800  
+++ gdm.schemas 2016-12-6 9:44:40.213279864 +0800  
@@ -25,22 +25,22 @@  
<schema>  
<key>daemon/AutomaticLoginEnable</key>  
<signature>b</signature>  
-  <default>false</default>  
+  <default>true</default>  
</schema>  
<schema>  
<key>daemon/AutomaticLogin</key>  
<signature>s</signature>  
-  <default></default>  
+  <default>leekwen</default>  
</schema>  
<schema>  
<key>daemon/TimedLoginEnable</key>  
<signature>b</signature>  
-  <default>false</default>  
+  <default>true</default>  
</schema>  
<schema>  
<key>daemon/TimedLogin</key>  
<signature>s</signature>  
-  <default></default>  
+  <default>leekwen</default>  
</schema>  
<schema>  
<key>daemon/TimedLoginDelay</key>  
@@ -51,7 +51,7 @@  
<schema>  
<key>debug/Enable</key>  
<signature>b</signature>  
-  <default>false</default>  
+  <default>true</default>  
</schema>
<schema>
 
修改后,完成的文件如下:
[root@localhost ~]# cat /etc/gdm/gdm.schemas  
<gdmschemafile>  
<schemalist> 
<schema>  
<key>chooser/Multicast</key>  
<signature>b</signature>  
<default>false</default>  
</schema>  
<schema>  
<key>chooser/MulticastAddr</key>  
<signature>s</signature>  
<default>ff02::1</default>  
</schema>
<schema>  
<key>daemon/User</key>  
<signature>s</signature>  
<default>gdm</default>  
</schema>  
<schema>  
<key>daemon/Group</key>  
<signature>s</signature>  
<default>gdm</default>  
</schema>  
<schema>  
<key>daemon/AutomaticLoginEnable</key>  
<signature>b</signature>  
<default>true</default>  
</schema>  
<schema>  
<key>daemon/AutomaticLogin</key>  
<signature>s</signature>  
<default>leekwen</default>  
</schema>  
<schema>  
<key>daemon/TimedLoginEnable</key>  
<signature>b</signature>  
<default>true</default>  
</schema>  
<schema>  
<key>daemon/TimedLogin</key>  
<signature>s</signature>  
<default>leekwen</default>  
</schema>  
<schema>  
<key>daemon/TimedLoginDelay</key>  
<signature>i</signature>  
<default>30</default>  
</schema>
<schema>  
<key>debug/Enable</key>  
<signature>b</signature>  
<default>true</default>  
</schema> 
<schema>  
<key>security/DisallowTCP</key>  
<signature>b</signature>  
<default>true</default>  
</schema>
<schema>  
<key>greeter/Include</key>  
<signature>s</signature>  
<default></default>  
</schema>  
<schema>  
<key>greeter/Exclude</key>  
<signature>s</signature>  
<default>bin,root,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,nobody4,noaccess,postgres,pvm,rpm,nfsnobody,pcap</default>
</schema>  
<schema>  
<key>greeter/IncludeAll</key>  
<signature>b</signature>  
<default>true</default>  
</schema>
<schema>  
<key>xdmcp/Enable</key>  
<signature>b</signature>  
<default>false</default>  
</schema>  
<schema>  
<key>xdmcp/MaxPending</key>  
<signature>i</signature>  
<default>4</default>  
</schema>  
<schema>  
<key>xdmcp/MaxSessions</key>  
<signature>i</signature>  
<default>16</default>  
</schema>  
<schema>  
<key>xdmcp/MaxWait</key>  
<signature>i</signature>  
<default>30</default>  
</schema>  
<schema>  
<key>xdmcp/DisplaysPerHost</key>  
<signature>i</signature>  
<default>1</default>  
</schema>  
<schema>  
<key>xdmcp/Port</key>  
<signature>i</signature>  
<default>177</default>  
</schema>  
<schema>  
<key>xdmcp/HonorIndirect</key>  
<signature>b</signature>  
<default>true</default>  
</schema>  
<schema>  
<key>xdmcp/MaxWaitIndirect</key>  
<signature>i</signature>  
<default>30</default>  
</schema>  
<schema>  
<key>xdmcp/PingIntervalSeconds</key>  
<signature>i</signature>  
<default>60</default>  
</schema>  
<schema>  
<key>xdmcp/Willing</key>  
<signature>s</signature>  
<default>/etc/gdm/Xwilling</default>  
</schema>  
</schemalist>  
</gdmschemafile>
 
如若实现普通用户的登陆,请自行将“leekwen”改为此用户名,重新reboot 机器即可。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/26614.html