Нет запроса пароля на команду sudo

Всякий раз, когда я запускаю команду sudo apt-get install ** , она не запрашивает пароль, также и у моего администратора.

Как заставить его запрашивать пароль?

Мой sudoer:

ubuntu:~$ 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.
#
# 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"

# 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
ALL ALL=(ALL) NOPASSWD:ALL
13
задан 21 June 2012 в 07:36

3 ответа

Я думаю, что лучше добавить «пользователя-администратора» в конец файла, потому что администратору не нужно вводить пароль в каждом порядке в терминале, и ни один другой пользователь не может делать это ни:

# 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"
# 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
# ALL ALL=(ALL) NOPASSWD:ALL
(user here) ALL=(ALL) NOPASSWD:ALL
0
ответ дан 21 June 2012 в 07:36

Отредактируйте /etc/sudoers с помощью sudo visudo и удалите последнюю строку:

ALL ALL=(ALL) NOPASSWD:ALL

(Кстати, обратите внимание, что эта строка в конце файла - , а не ] предпочтительный способ заставить sudo не запрашивать пароль для тех, кто хочет это сделать.)

0
ответ дан 21 June 2012 в 07:36

Используйте эту команду, чтобы найти источник проблемы:

sudo grep -HRn NOPASSWD /etc/sudoers.d/

В моем случае:

/etc/sudoers.d/50_stack_sh:1:username ALL=(root) NOPASSWD:ALL

прокомментировать строку с # и закрыть свой терминал.

0
ответ дан 21 June 2012 в 07:36

Другие вопросы по тегам:

Похожие вопросы: