You are not logged in.

#1 2010-05-09 17:15:55

scottbnel
Member
Registered: 2009-12-08
Posts: 2

having problems with Slim...running ssh-add in my bashrc

I have my .bashrc file setup to start an ssh-agent and prompt me for my SSH key's passphrase the first time it is executed.  This worked fine before I started using a login manager (Slim) since an interactive shell was started before I ran startx.  My problem now is that Slim must be running my .bashrc since it hangs while waiting for input (for ssh-add).  Since I have no interactive shell the only way I can end the hang is by switching over to tty6 and killing ssh-add.  How do I correct this?

Here is the code that starts ssh-agent and runs ssh-add...

SSH_ENV="${HOME}/.ssh/envrionment"

function start_agent {
    ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    chmod 600 "${SSH_ENV}"
    source "${SSH_ENV}" > /dev/null
    ssh-add
}

if [ -f "${SSH_ENV}" ]; then
    source "${SSH_ENV}" > /dev/null
    ps -ef | grep "${SSH_AGENT_PID}" | grep ssh-agent$ > /dev/null || start_agent
else
    start_agent
fi

I also have

[ -z "$PS1" ] && return

at the top of my .bashrc.

Thanks,
Scott

Offline

#2 2011-06-08 06:14:39

Flavious
Member
Registered: 2007-11-24
Posts: 49

Re: having problems with Slim...running ssh-add in my bashrc

Bump. I would also need a solution to this problem. (I'm coming here from google)

Offline

#3 2011-06-08 13:47:21

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: having problems with Slim...running ssh-add in my bashrc

Back when I used slim, I solved this by changing login_cmd in slim.conf from /bin/bash to /bin/sh.

If you want to know why this works, read the INVOCATION section of the bash man page.

Offline

Board footer

Powered by FluxBB