如何启用sudo密码?

ear*_*hae 2 sudo password

我刚刚在 Windows Azure 集群的虚拟机上安装了 Ubuntu 12.04。

默认情况下sudo不需要密码。

我想对所有sudo命令强制密码。

我该如何进行此更改?

以下是内容visudo

#
# 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 secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults timestamp_timeout=0

# 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
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
Run Code Online (Sandbox Code Playgroud)

gre*_*n55 6

一开始我很困惑。后来我在/etc/sudoers.d/90-cloud-init-users.

# Created by cloud-init v. 0.7.5 on Tue, 16 Sep 2014 14:34:31 +0000

# User rules for azureuser
azureuser ALL=(ALL) NOPASSWD:ALL
Run Code Online (Sandbox Code Playgroud)

评论最后一行将解决您的问题。