open new tabs/windows with the same user as the current shell
@calestyo
Submitted by Christoph Anton Mitterer Link to original bug (#737557)
Description
Hi.
This is probably a bit tricky to implement ;-)
If a terminal is open with a shell running in it in which a switch to another UID/GID took place,... pressing Ctrl-N/T for new windows respectively tabs should optionally open the new window/tab with the same effective UID/GID than the current one.
Simple use case: I open a terminal as user, su within it to root or any other user, and when I create further tabs/windows I'd like to have them also with shells for that user.
One question is, whether all this should just work when Ctrl+N/T is pressed while only the shell is running (i.e. one sees a prompt and no other process runs). Not sure whether this should be a requirement. But if so, while finding out whether only the shell runs should be rather simple, finding out whether one sees a prompt or whether some shell script is being executed is probably not so easy.
And of course there's the question on "how to technically do the whole thing". I guess everyone will agree that we don't want to have gnome-terminal being suid. But a possible solution could go in the following directiong: If one has already e.g. switched user to root within the first terminal, than one could of course run another instance of the shell from within that switched user session, with the same rights (e.g. root again). Now that bash must "just" be connected to another terminal (the one from the new window/tab), while to old one must return to the first window.
There are tools out there which do such tricky things as reconnecting the pty of existing processes to somewhere else (reptyr probably being the most popular one).
Of course there are more issues needed to be dealt with:
- if the originating terminal is hung up/killed/etc. (or just logged out of the user), the ones spanwed from that must of course continue to work.
- all this must be properly integrated with login session tracking (e.g. of systemd)
Cheers, Chris.
Version: 3.14.x
Resolution: RESOLVED WONTFIX