【问题标题】:Why can't I get sudo to ask for password?为什么我不能让 sudo 要求输入密码?
【发布时间】:2017-09-28 21:40:18
【问题描述】:

这是我在一个新的 ubuntu ec2 机器上的 sudoers 文件。为什么sudo su 不需要密码?

#
# 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:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) PASSWD:ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) PASSWD:ALL

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

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

#includedir /etc/sudoers.d

有什么延迟吗?您是否想“获取”它或类似于您对 bashrc 文件所做的事情?为什么让sudo su 要求输入密码这么难?

编辑: 每个this 链接,正在运行:

sudo passwd ubuntu
sudo perl -pi -e 's/^(ubuntu.*)NOPASSWD:(.*)/$1$2/' /etc/sudoers

不起作用,甚至不会更改 sudoers 文件。

【问题讨论】:

    标签: amazon-ec2 passwords sudo


    【解决方案1】:

    尝试删除以下三个位置的PASSWD:ALL

    # User privilege specification
    root    ALL=(ALL:ALL) 
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) 
    
    # Allow members of group sudo to execute any command
    %sudo   ALL=(ALL:ALL) 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-24
      • 2013-10-24
      • 1970-01-01
      • 1970-01-01
      • 2017-10-27
      • 2022-06-25
      • 2011-04-18
      • 2013-10-07
      相关资源
      最近更新 更多