2017-09-28 118 views
0

這是我在一個新的ubuntu ec2盒子上的sudoers文件。爲什麼sudo su仍然需要密碼?爲什麼我無法獲得sudo密碼?

# 
# 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文件。

回答

0

嘗試以下三個位置

# 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) 
刪除 PASSWD:ALL
相關問題