one sudo for multiple terminals

13

4

Sudo root permissions are given for specific time, but only for one terminal. If I want to use sudo in another terminal in that time period, I have to type password again. How to force sudo to works across terminals?

Tomek Wyderka

Posted 2013-04-27T15:08:12.963

Reputation: 501

Those are different user sessions. Would you like your sudo also affect other users (not you)? – Sergio Tulentsev – 2013-04-27T15:14:15.490

3run screen after you start a shell with sudo? – jordanm – 2013-04-27T15:24:27.110

When I open two terminals in my window manager, from my (human) perspective it is one session. I want sudo affects every process run by me (the same user) using command sudo. I don't think I want too much. I really don't like when somebody gives me negative points, just because they never ask themselves such questions. – Tomek Wyderka – 2013-04-27T15:26:52.540

@jordanm: it will work, thanks. but after parent sudo expires, I will have to detach that screen and fire sudo in parent terminal again. thanks anyway! – Tomek Wyderka – 2013-04-27T15:28:50.113

1Upvoting, if only because I'm curious as to how I'm viewing the opposite behavior: entering a password in one shell allows password-less sudo in other shells on the same machine. – chepner – 2013-04-27T16:35:25.787

@chepner - I do not see how that could happen, unless the user entered directly went into a child process that somehow became a session leader, as in daemonizing. – jim mcnamara – 2013-04-27T18:00:09.270

so as I understand from yours comments, sudo grants permissions only to child processes. there is no global (like /var/sudo/lock_with_time) flag/semaphore ? it should be easy to extend sudo package. I will look into sources. – Tomek Wyderka – 2013-04-27T18:31:43.847

1Running screen via sudo kinda defeats the entire point of sudo, doesn't it? You could as well use su by that point. – Staven – 2013-04-27T23:16:46.490

sudo on terminal, then exit, and screen, doesn't make child processes to react to new sudo commands reusing parent sudo authentication. I should tested earlier :) – Tomek Wyderka – 2013-04-28T05:26:36.970

Answers

19

Turn off tty_tickets. See sudoers(5) for more information.

Run visudo and then add a line:

Defaults !tty_tickets

icktoofay

Posted 2013-04-27T15:08:12.963

Reputation:

@TomekWyderka by running visudo or editing /etc/sudoers – Prof. Falken contract breached – 2015-04-09T09:38:19.443

@Prof.Falken by visudo. Actually, you cannot change sudoers file by normal editing (or maybe I'm wrong) – Tomek Wyderka – 2015-04-09T13:15:30.230

This is the feature I'm looking for! Great. (Disable it by Defaults !tty_tickets) – Tomek Wyderka – 2013-04-28T05:23:38.750