Re: ssh-agent, keychain, xsession bash_profile scripting
Am 15.01.2010 um 22:36:53 schrieb Rob Owens:
> On Fri, Jan 15, 2010 at 05:11:14PM +0000, Adam Hardy wrote:
>> Jeff D on 15/01/10 17:00, wrote:
>>> On Fri, 15 Jan 2010, Adam Hardy wrote:
>>>
>>>> I've been chasing my tail trying to work this one out following different
>>>> examples off the web, but can't sort it out and keep getting the old
>>>>
>>>> "Could not open a connection to your authentication agent."
>>>>
>>>> from ssh-add, and nothing but inaction from keychain.
>>>>
>>>> I know everything has to run as a child of ssh-agent to gain access to its
>>>> envvars, but I don't how to achieve this.
>>>>
>>>> keychain id_rsa in my .bash_profile doesn't work, I still have to give ssh my
>>>> password for the private key when I use ssh.
>>>>
>>>> I guess I should be setting up the envvars in my bash env somehow when getting
>>>> them via 'ssh-agent -s' but I don't know the syntax to do this.
>>>>
>>>> I always boot into a command line and then run startx when I need it, and I
>>>> think herein lies the problem - although I can't get it to work on the command
>>>> line either with keychain or ssh-add.
>>>>
>>>> Thanks
>>>> Adam
>>>
>>>
>>> Hi Adam,
>>>
>>> from the command line you can run :
>>>
>>> ssh-agent bash
>>> #that starts your agent for that shell, you will need to run that for each
>>> shell you want to have access to your keys
>>> ssh-add -i /path/to/your/key
>>>
>>>
>>> For X, in /etc/X11/Xsession.options, check and make sure you have
>>> use-ssh-agent in there.
>> [SNIP]
>>
>> What I'm trying to do is to get this set up in my .bash_profile so that I
>> only need to type in my key password once when I log into the machine.
>>
>> I can't put the two command in my .bash_profile because the 2nd command
>> won't get executed until the first bash shell exits.
>>
> What about following the first command with: &
>
> Does that work?
you should do it this way, i think.
http://mah.everybody.org/docs/ssh
bye,
Michael.
Reply to: