[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using screen's su command to attach to somebody else's lost session
From: |
Michael Schroeder |
Subject: |
Re: Using screen's su command to attach to somebody else's lost session |
Date: |
Fri, 22 Sep 2006 23:22:07 +0200 |
User-agent: |
Mutt/1.4.2.1i |
On Mon, Sep 18, 2006 at 03:48:48PM +0800, Wayne Ivory wrote:
> 1. I modified a forklift driver's .profile to do a screen -list and
> look for the word "Attached". If it is found then it does a screen -x
> to attached to the dropped session, otherwise it runs screen and invokes
> the ERP system. This works ideally! Now thinking ahead, it's possible
> that a forklift driver may go to lunch or even go home whilst he has a
> dropped session, so I would like his supervisor to be able to do the
> attach so I started checking out the add* commands. At the very least
> I'd like we IT people to be able to attach by logging in as root so I
> did this and tried invoking screen's (not unix's) su command. It
> prompted me for the user name and unix password and then prompted me for
> the screen password. I tried leaving it blank, entering the word none,
> entering the same password as the unix password, but in all cases screen
> replied with Sorry. How can root attach to a general user's session?
You should add "multiuser on" and "acladd root" to the user's screenrc
to allow root to attach to the session. Then root can attach with
screen -x <username>/
Screen's internal "su" command is just for switching internal ids
if you're already attached. You probably will never need it.
> 2. As a variation on the theme of the above case, when the forklift
> driver goes to lunch he may not log out. When he comes back if he is
> assigned to a different forklift that is not logged in then he will log
> in and his .profile as it stands will detect the "Attached" session and
> attach to it, but of course this will go multi-user on the live
> connection so when another driver jumps on the original forklift the two
> drivers will be fighting for control of the one session. How can I tell
> if an "Attached" session is the result of a dropped radio link or if it
> is live?
If "screen -ls" prints "Attached" then screen never received a hangup,
so there is no way to detect if it is dropped or still alive.
Cheers,
Michael.
--
Michael Schroeder address@hidden
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}