先提一下我的系统:LinuxMint 17 xfce 32-bits(基于 ubuntu 14.04 LTS)
ubuntu sudo 时输密码可烦人了,其实解决起来也不难,请看
我们先看看 sudo 的配置文件 $sudo cat /etc/sudoers
#
# 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.
在注释中我们可以看到系统为了安全起见,不建议我们直接编辑这个配置文件(万一处理不好可能你就没法使用 sudo 了),而是编辑 /etc/sudoers.d/ 目录下的文件。好,我们就进入 /etc/sudoers.d/ 来看看
$ ls
mintupdate README
养成一个好习惯,先看 README ,
$sudo cat README
#
# As of Debian version 1.7.2p1-1, the default /etc/sudoers file created on
# installation of the package now includes the directive:
#
# #includedir /etc/sudoers.d
#
# This will cause sudo to read and parse any files in the /etc/sudoers.d
# directory that do not end in '~' or contain a '.' character.
#
# Note that there must be at least one file in the sudoers.d directory (this
# one will do), and all files in this directory should be mode 0440.
好了,此时你应该知道怎么做了吧,touch 一个文件 nopasswd4sudo,内容如下,
yourusername ALL=(ALL) NOPASSWD: ALL
完成之后,记得按要求 sudo chmod 0440 nopasswd4sudo 哦
更改完之后,sudo apt-get update 直接就更新了,说明sudo每次执行时都会先查看 /etc/sudoers.d/ 目录下的文件的