sudo 一直问我在鱼壳中的密码

end*_*ith 19 linux sudo passwords fish ubuntu-11.04

Ubuntu 中的 sudo 不断向我询问每个命令的密码。以前,我只需要输入一次密码,然后就会记住一段时间。这最近发生了变化,可能是在“升级”到 Natty 之后。

我已经完成sudo visudo并设置Defaults env_reset, timestamp_timeout = 60,尝试重新启动,但它仍然无法正常工作。我该如何解决?

经过以下建议,我/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:endolith timestamp_timeout=60

# 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

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

更新:

我升级了我的 VirtualBox,它开始遇到同样的问题。猜测一下,我运行了 bash,并尝试在其中执行 sudo,并且正确记住了密码。只有当我使用默认的贝壳鱼时,它才不记得。它在之前的 Ubuntu 版本中确实如此,但不再如此。

更新:

我升级到 13.05,这神奇地再次开始工作。现在它询问我的密码一次,停止询问一段时间,然后在一段时间后再次询问。

小智 15

@endolith:是的,它似乎只影响鱼。我遇到了同样的问题,问题是由 sudo 选项“tty_tickets”引起的。在您的 /etc/sudoers 文件上禁用此功能将解决问题。

以下将禁用 tty_tickets:

Defaults        env_reset,!tty_tickets
Run Code Online (Sandbox Code Playgroud)


Bro*_*oam 5

如果没有其他效果,请尝试sudo -i(单独)。这将在一个密码后为您提供一个 root shell。

  • 很棒的一点,但比请求稍有风险。 (6认同)