Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scripting Terminal to run "ssh-agent" and then "ssh-add"

1 view
Skip to first unread message

Tony Lawrence

unread,
Jan 10, 2003, 11:01:50 AM1/10/03
to
I always have one terminal window set up running ssh-agent because I use
it all day long to copy stuff to and from my web site.

So.. I'd like to startup the window and have it automaticallly run
"ssh-agent /bin/bash" and THEN run "ssh-add".

Of course you can't do "ssh-agent /bin/bash;ssh-add" because ssh-agent
starts a new shell. But in all my attempts so far, Applescript seems to
remain either talking to the first shell or to nothing at all: I can't
get ssh-add to run. I can easily see how that could happen, but is
there any way around it?


--
Tony Lawrence
Free SCO and Linux Skills Tests: http://aplawrence.com/skillstest.html

Patrick Stadelmann

unread,
Jan 10, 2003, 11:52:54 AM1/10/03
to
In article <O7CT9.634756$%m4.2...@rwcrnsc52.ops.asp.att.net>,
Tony Lawrence <to...@pcunix.com> wrote:

> Of course you can't do "ssh-agent /bin/bash;ssh-add" because ssh-agent
> starts a new shell. But in all my attempts so far, Applescript seems to
> remain either talking to the first shell or to nothing at all: I can't
> get ssh-add to run. I can easily see how that could happen, but is
> there any way around it?

Use an init file :

tell application "Terminal"
do script "ssh-agent /bin/bash --init-file ~/.ssh_bash_start"
end tell

with ~/.ssh_bash_start simply containing "ssh-add"

Patrick
--
Patrick Stadelmann <Patrick.S...@unine.ch>

Tony Lawrence

unread,
Jan 10, 2003, 12:11:36 PM1/10/03
to

Thank you. Where did you know --init-file from? I saw nothing in the
man page for that..

Tony Lawrence

unread,
Jan 10, 2003, 12:20:58 PM1/10/03
to
Tony Lawrence wrote:
> Patrick Stadelmann wrote:
>
>> In article <O7CT9.634756$%m4.2...@rwcrnsc52.ops.asp.att.net>,
>> Tony Lawrence <to...@pcunix.com> wrote:
>>
>>
>>> Of course you can't do "ssh-agent /bin/bash;ssh-add" because
>>> ssh-agent starts a new shell. But in all my attempts so far,
>>> Applescript seems to remain either talking to the first shell or to
>>> nothing at all: I can't get ssh-add to run. I can easily see how
>>> that could happen, but is there any way around it?
>>
>>
>>
>> Use an init file :
>>
>> tell application "Terminal"
>> do script "ssh-agent /bin/bash --init-file ~/.ssh_bash_start"
>> end tell
>>
>> with ~/.ssh_bash_start simply containing "ssh-add"
>
>
> Thank you. Where did you know --init-file from? I saw nothing in the
> man page for that..


Oh duh!!!

Have to read the right man page on the right system!!!

First, I was looking at ssh-agent when (duh!) I needed to look at bash,
and secondly I read the bash page on a bash 2.04 Linux box rather than
here on the Mac..

Dan Lowe

unread,
Jan 11, 2003, 1:52:25 AM1/11/03
to
Tony Lawrence <to...@pcunix.com> wrote:
> I always have one terminal window set up running ssh-agent because I use
> it all day long to copy stuff to and from my web site.
>
> So.. I'd like to startup the window and have it automaticallly run
> "ssh-agent /bin/bash" and THEN run "ssh-add".
>
> Of course you can't do "ssh-agent /bin/bash;ssh-add" because ssh-agent
> starts a new shell. But in all my attempts so far, Applescript seems to
> remain either talking to the first shell or to nothing at all: I can't
> get ssh-add to run. I can easily see how that could happen, but is
> there any way around it?

Use SSH Agent: http://www.phil.uu.nl/~xges/ssh/

Works beautifully, and ties into Keychain for passphrases. Ties into CVS
over SSH as well (including inside Project Builder).

--
I am not a vegetarian because i love animals; I am a vegetarian because
I hate plants. -A. Whitney Brown

0 new messages