On Sat, Oct 08, 2016 at 09:41:41AM -0400, Predrag Punosevac wrote: > "soko.tica" <soko.t...@gmail.com> wrote: > > > Hi Predrag, > > > > I am not sure that I am getting your question right, but for starting ssh > > agent on my lap, I simply uncomment (or create?) the following in my > > .xinitrc > > You are not. I am not running X so I am not using .xinitrc. I am ssh-ing > to the headless server and I want to run ssh-agent automatically on that > remote server. I think I need similar script in my .profile. >
I use this snipped in a similar setup: --%<----%<-- pgrep -u $USER ssh-agent >/dev/null || ssh-agent -t 28800 > ~/.ssh-agent.out eval $( cat ~/.ssh-agent.out ) >/dev/null ssh-add -l | grep "The agent has no identities." >/dev/null && ssh-add --%<----%<-- Tha last line could be removed if you have an up-to-date ssh client that supports "AddKeysToAgent yes" Remi > > ... > > if [ "$SSH_AGENT_PID" ]; then > > ssh-add -D < /dev/null > > eval `ssh-agent -s -k` > > fi > > ... > > > > For starting (and keeping alive) a ssh agent on a remote host I use > > http://www.funtoo.org/Keychain > > > > keychain is for Linux kids who don't want to learn how to use > ssh-agent:) > > > > If the keys of the remote host are password protected, the password needs > > to be typed in upon any (re)start of the remote host. > > > > I hope I was on topic. > > > > Regards, > > > > On Fri, Oct 7, 2016 at 10:38 PM, Predrag Punosevac <punoseva...@gmail.com> > > wrote: > > > > > Hi Misc, > > > > > > This is a rather trivial question. What is the recommended way of > > > starting ssh-agent when upon ssh login into the remote host. Namely I > > > have a remote host which is used as a gateway to a bunch of machines > > > whose ssh keys are password protected. I have > > > > > > AddKeysToAgent yes > > > > > > in my ~/.ssh/config file as well as > > > > > > xidle -program "/usr/bin/ssh-add -D" -timeout 300 & > > > > > > in my .xsession file. Everything works nice and neat when I am on my > > > desktop but I want to replicate functionality when I ssh to a headless > > > (no X) shell gateway. > > > > > > Thanks, > > > Predrag