Re: using "at" and ssh
- From: Anonymous <cripto@xxxxxxx>
- Date: Sat, 31 Dec 2005 18:40:46 +0100 (CET)
> > Cloud Burst <DoNotReplyViaEmail@xxxxxxxxxxx> wrote:
> > So let's say I do this and come back the next day. My job ran fine,
> > but now there is this ssh-agent running that I can't use for anything,
> > right? According to the ssh-add man page (and I tried) I can't use a
> > new ssh-add against this old ssh-agent. I have to start a new agent.
> John Wingate <johnww@xxxxxxxxxxxxx> wrote:
> You don't have to start a new agent. You can use the old agent if you
> have saved the relevant environment variables in a file so they can be
> read by your new shell. A few lines in my .bash_profile do this, along
> with a check that the agent still exists:
>
> # Save ssh-agent environment variables in a file
> # so that they can be read by processes not inheriting
> # this environment; e.g., those started by cron.
> # But don't start more than one agent, so check first.
> [ -f $HOME/.ssh-agent ] && . $HOME/.ssh-agent
> if ! ssh-add -l >/dev/null 2>&1
> then
> ssh-agent | head -2 >$HOME/.ssh-agent
> . $HOME/.ssh-agent
> fi
>
> If the data in $HOME/.ssh-agent is stale (i.e., the corresponding agent
> is dead), ssh-add will return an error and a new agent will be started.
> Scripts (started by cron, for example) just have to read in the
> environment variables to be able to contact the agent, with a line
> like:
> . $HOME/.ssh-agent
> (with perhaps a check for a dead agent as above and suitable error
> handling).
Like John said, the clients (ssh,ssh-add) rendezvous with the agent via
two environment variables: SSH_AGENT_PID and SSH_AUTH_SOCK
You need to save and restore these two variables via some scheme such
as the one John provided.
.
- References:
- using "at" and ssh
- From: RR
- Re: using "at" and ssh
- From: Anonymous
- Re: using "at" and ssh
- From: John Wingate
- using "at" and ssh
- Prev by Date: Re: Path Problems with 4.2p1?
- Previous by thread: Re: using "at" and ssh
- Next by thread: UsePAM and PasswordAuthentication under 4.1p1
- Index(es):
Relevant Pages
|
|