I'm unclear on the terminology here, so please bear with me.
I use Tmux. I sudo foo
in my current pane. It prompts for my password; I enter it. Now, for a while, the pane doesn't have to prompt again for my password when I sudo
things.
However, if I make a new pane in the current window (e.g. to edit a file while keeping the original pane visible), and I sudo bar
, it will prompt for my password again.
Is there a way to pass the "sudo unlocked" state of the first pane to the second one at the moment I create it?
For what it's worth, my shell is Zsh.
To be clear: I'm expecting a Tmux answer here, perhaps a way to change my window-splitting bindings to execute some command upon creating a pane. But I'd also be interested in other ways to configure this behaviour.
man 5 sudoers
, search fortty_tickets
. It looks like you can configuresudo
to keep a single ticket for all your panes and everything else. But you want to escalate the new pane only, right? I expect it's hard to tricksudo
it runs under the same controlling terminal as the old pane. Let's suppose you can do this somehow. Thensudo
will spawn the actual command with "counterfeit" terminal. But you need the command itself to use the new tty (especially in your example, where you want to edit a file interactively), so you should trick it "back" in a similar way. – Kamil Maciorowski Aug 21 '19 at 9:32