Complete.Org: Mailing Lists: Archives: discussion: January 2000:
[aclug-L] odd shell question
Home

[aclug-L] odd shell question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aclug-L@xxxxxxxxxxxx
Subject: [aclug-L] odd shell question
From: Jeff <schaller@xxxxxxxxxxxxx>
Date: Mon, 31 Jan 2000 07:55:44 -0600 (CST)
Reply-to: aclug-L@xxxxxxxxxxxx

I have an odd one for y'all. Just when you think you know how
something should work...

I installed openssl and openssh on this laptop here, and went to
make things more automated by using ssh-agent and ssh-add.  The
manpage for ssh-agent suggests:

     Here's a trick that will allow you to start this up from your
     .bash_profile (just put it in as the first thing that
     happens):

          [ ! "$SSH_AGENT_PID" ] && exec ssh-agent -- bash --login
          ssh-add

The two commands appear to be on one line in the manpage, but I
assume (!) they're to be two separate lines -- it runs
(execs) ssh-agent to run bash (--login), which will source
.bash_profile again, but the test will fail the 2nd time around,
running ssh-add after the environment variables are set (which is
correct).  Additionally, bash complains if you try to run it
like: "bash ssh-add": "ssh-add: /usr/local/bin/ssh-add: cannot
execute binary file". (since ssh-add isn't a shell script).

The problem with the manpage's suggestion is: on login, bash gets
to the 'exec' line and hangs (it runs ssh-agent -- bash --login),
but I never get a prompt back.

If I change .bash_profile to simply /run/ ssh-agent, it works just
fine (but I end up with a SHLVL of 2 & having to exit twice,
provoking future momentary confusement).

If I run 'exec ssh-agent -- bash' from the commandline, it works
just fine, giving me a prompt back. Same with "exec ssh-agent --
bash --login".

It breaks if I put it in .bash_profile, however.

I put 'set -x' at the top of .bash_profile to watch what happens,
and it's executed just like I think it should be; it's just that
it hits the 'exec ssh-agent...' line and I never see bash again.

Anyone seen anything like this? The system is a 'install
everything because I'm tired of fighting with you' Mandrake 6.1,
which I'm not intimately familiar with, but was the easiest choice
at the time.

Thanks :)

-jeff
-- 
default, n.: [Possibly from Black English "De fault wid dis system is you,
mon."] The vain attempt to avoid errors by inactivity.  "Nothing will
come of nothing: speak again." -- King Lear. -- Stan Kelly-Bootle



[Prev in Thread] Current Thread [Next in Thread]
  • [aclug-L] odd shell question, Jeff <=