I have already seen [SOLVED] Why sudo asks for user password in tmux/ssh session? · GitHub Gist, and it looks like this is there by design, but I thought I'd ask anyways:

Say I use a command like this:

tmux new-session -d 'sudo udevadm monitor -e' \; attach

As soon as tmux starts the new session, it asks for the sudo password, as expected. But then I try to "cheat" by attempting to validate sudo beforehand:

$ sudo --validate
[sudo] password for user:
$ tmux new-session -d 'sudo udevadm monitor -e' \; attach

... and this asks again for a sudo password as soon as tmux starts the session - even if I already entered the password successfully beforehand.

So is there a way to start a tmux session with (a) sudo'ed process(es) inside, with only one sudo password validation beforehand?

  • 1
    Do you have control or influence over your sudoers configuration?
    – Jeff Schaller
    Jan 26, 2019 at 12:45
  • Thanks, @JeffSchaller - in this case I do
    – sdaau
    Jan 26, 2019 at 13:03

1 Answer 1


The simplest solution, if you can modify /etc/sudoers, is to unset the tty_tickets option for your user:

Defaults:yourlogin !tty_tickets

Then you can run a sudo command before running tmux, and sudo will update your (single) timestamp and allow the subsequent sudo commands without a password prompt (within the timestamp_timeout).

This is the pertinent option because, typically, the tty_tickets option is set, which requires a password for each tty and tmux starts a new tty.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .