[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: bash $TMOUT



2008/7/23 Ricky Zhou <ricky fedoraproject org>:
> On 2008-07-23 09:07:58 AM, Mike McGrath wrote:
>> On Wed, 23 Jul 2008, Jorge Bras wrote:
>> > If people start using screen they just have to reconnect, et voila, continue
>> > to work.
>> > At least for me, screen was the solution.
> A downside with that solution is that if I detach a screen session
> and end my SSH session, the next time I reattach, I lose my SSH agent,
> and that means having to type SSH passwords repeatedly until I
> completely destroy and reconstruct the screen session.

The trick to using screen and an ssh agent is to reset the environment
variables that point to your ssh connection.  Here is a script I use to
store the connection information in a file that is sourced by my shell if
it can't find my agent, and the "ss" alias I use to rejoin my session from
another location.  I found this somewhere on the web and modified it.

~ % grep ssh-env .zaliases
alias -- ss='~/bin/ssh-env && screen -d -R'

~ % cat bin/ssh-env
#!/bin/sh
SSHVARS="SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION DISPLAY"
for x in ${SSHVARS} ; do
   echo "export $x=\"$(eval echo \$$x)\""
done 1>$HOME/.ssh/env

~ % grep .ssh/env .zshenv
ssh-add -l >/dev/null 2>&1 || { [[ -r ~/.ssh/env ]] && source ~/.ssh/env }

-- 
Jared Brothers


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]