转自http://www.cnblogs.com/lanxuezaipiao/p/3617436.html?foxhandler=RssReadRenderProcessHandler
/etc/gdm/
目录下有个
custom.conf
或者
gdm.conf
或
gdm.conf-custom
文件,比如我的Ubuntu9.11下的gdm下有这些文件:
gdm.conf-custom
,截取最前面的几句注释说明如下:
# GDM Configuration Customization file. # # This file is the appropriate place for specifying your customizations to the # GDM configuration. If you run gdmsetup, it will automatically edit this # file for you and will cause the daemon and any running GDM GUI programs to # automatically update with the new configuration. Not all configuration # options are supported by gdmsetup, so to modify some values it may be # necessary to modify this file directly by hand. # # Older versions of GDM used the "gdm.conf" file for configuration. If your # system has an old gdm.conf file on the system, it will be used instead of # this file - so changes made to this file will not take effect. Consider # migrating your configuration to this file and removing the gdm.conf file.
gdm.conf
老配置文件,那么该文件中的值就不会起作用。那么我们就去
gdm.conf
里配置吧,打开后找到下面这一段:
[daemon] # Automatic login, if true the first attached screen will automatically logged # in as user as set with AutomaticLogin key. AutomaticLoginEnable=false AutomaticLogin=
AutomaticLoginEnable
变量值改为true就可以了。
sudo gdmsetup
这个命令,运行后会出现设置界面,进入“Security”选项卡:
普通用户登录Ubuntu一般使用的是普通账户而非管理员账户,因此运行有管理员权限的程序时都要输入sudo [command],这样的命令输入非常频繁,关键是每次都要输入一次用户自己的密码,非常烦人,下面就教你使用sudo不用输入密码的小技巧。
解决方案:
假设我的用户名为hadoop,使用sudo不用密码的方法如下:
运行命令:
或者sudo visudo
sudo vi /etc/sudoers
,如果vi来编辑,则保存时记得用"wq!"强制保存,否则会提示只读不能保存的。
# This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges
注意:这里有个问题需要注意,就是后面的配置可能会覆盖前面的配置,所以你添加的配置最好是在最后一行。
参考文献:
非常Linux——sudoers文件的写法