首先執(zhí)行以下命令(該命令用來修改 /etc/sudoers 文件):
$ sudo gedit /etc/sudoers
然后把 %sudo ALL=(ALL:ALL) ALL 這行注釋掉,就是加一個#號在前面
用這句替代剛剛注釋掉的那句
%sudo ALL=NOPASSWD: ALL 移動到文件未尾,如下所示:
# %sudo ALL=(ALL:ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=NOPASSWD: ALL
然后再執(zhí)行以下命令:
sudo adduser `你的用戶名` sudo
就可以了。
第一步的作用是使隸屬于 Ubuntu sudo 組的用戶在執(zhí)行 sudo 命令時不需要輸入密碼。
第二步的作用是把你自己加入 Ubuntu sudo 組。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ubuntu12.04取消sudo輸入密碼
1、命令行輸入:sudo visudo
2、在最后輸入: 你的用戶名 ALL=(ALL) NOPASSWD:ALL
3、ctrl + o
4、ctrl + x