使用gnome-terminal保持sudo身份验证


10

可以sudo在的各个标签之间共享会话吗gnome-terminal,这样,一旦sudo在一个标签中使用过,就不必每次打开另一个标签并使用时都重新输入密码sudo

Answers:


11

sudo所有 Shell会话之间共享身份验证(不仅限于特定gnome-terminal实例的选项卡),您需要将此行添加到/etc/sudoers文件中(用于visudo这样做):

Defaults !tty_tickets

来自man sudoers

   sudoers uses time stamp files for credential caching.  Once a user has
   been authenticated, a time stamp is updated and the user may then use
   sudo without a password for a short period of time (15 minutes unless
   overridden by the timeout option.  By default, sudoers uses a tty-based
   time stamp which means that there is a separate time stamp for each of
   a user's login sessions.  The tty_tickets option can be disabled to
   force the use of a single time stamp for all of a user's sessions.

   [...]

   tty_tickets     If set, users must authenticate on a per-tty basis.
                   With this flag enabled, sudo will use a file named for
                   the tty the user is logged in on in the user's time
                   stamp directory.  If disabled, the time stamp of the
                   directory is used instead.  This flag is on by default.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.