Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
keychain + GNU screen problems [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
d_m
Guru
Guru


Joined: 12 Jun 2003
Posts: 570
Location: Philadelphia, PA, USA

PostPosted: Tue Jul 26, 2005 3:18 pm    Post subject: keychain + GNU screen problems [SOLVED] Reply with quote

Hey, I've been using keychain from within Gnome for awhile and it's a really sweet program. I have SSH keys set up properly and I don't have to use a password to SSH to my remote hosts from Gnome Terminal or XTerm.

Recently, I started using GNU screen on this box and no matter what I do it seems like I can't get screen to use the same SSH-agent. It asks me for my SSH key's password, which I give, and then SSH works, but I can't get it to detect the agent is running. I have tried starting keychain from within screen, and that doesn't seem to make a difference.

Do I need to have multiple ssh-agents running (one in the context of Gnome, one in the context of screen) for this to work? Does anyone have any ideas?

Thanks.
_________________
The name that can be named is not the eternal name.


Last edited by d_m on Tue Jul 26, 2005 5:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
Nuteater
Apprentice
Apprentice


Joined: 25 Sep 2003
Posts: 193
Location: Jyväskylä, Finland

PostPosted: Tue Jul 26, 2005 3:58 pm    Post subject: Reply with quote

It seems the environment variables associated with ssh-agent
need to be loaded inside the screen session to have effect.
Google came up with this:
http://unix.frogcircus.org/screen/ssh-agent
I hope it helps :)
_________________
I am Nuteater, hear me roar.
Back to top
View user's profile Send private message
d_m
Guru
Guru


Joined: 12 Jun 2003
Posts: 570
Location: Philadelphia, PA, USA

PostPosted: Tue Jul 26, 2005 4:12 pm    Post subject: Reply with quote

Thanks, that is really helpful!
_________________
The name that can be named is not the eternal name.
Back to top
View user's profile Send private message
d_m
Guru
Guru


Joined: 12 Jun 2003
Posts: 570
Location: Philadelphia, PA, USA

PostPosted: Tue Jul 26, 2005 5:41 pm    Post subject: Reply with quote

OK, so the trick that I have found is to populate ${HOME}/.ssh/screen_agent (or whatever you want to call the file) with something like this (assuming you're running a bourne compatible shell):

Code:
export SSH_AUTH_SOCK=/tmp/ssh-fSKjSC7991/agent.7991
export SSH_AGENT_PID=8008


And then add to ${HOME}/.screen (somewhere before you want to launch your shells/ssh sessions):

Code:
source $HOME/.ssh/screen_agent


To do the above, I wrote a script called mykeychain which calls keychain for me but also creates the appropriate file:

Code:
#!/bin/sh

keychain ${HOME}/.ssh/id_dsa

(
echo "export SSH_AUTH_SOCK=${SSH_AUTH_SOCK}"
echo "export SSH_AGENT_PID=${SSH_AGENT_PID}"
) > ${HOME}/.ssh/screen_agent


So yeah, I hope this helps someone else. I'm marking this thread solved.
_________________
The name that can be named is not the eternal name.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum