You are not logged in.
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
Bump. I would also need a solution to this problem. (I'm coming here from google)
Offline
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