gnome-terminal で sudo 認証を維持する

gnome-terminal で sudo 認証を維持する

sudoのタブ間でセッションを共有してgnome-terminal、あるタブで を使用した後はsudo、別のタブを開いて を使用するたびにパスワードを再入力する必要がなくなるようにすることはできますかsudo?

答え1

sudo認証を共有するには全てシェル セッション (特定のインスタンスのタブだけでなく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.

関連情報