On May 28, 2006, at 11:21 AM, Kevin O'Gorman wrote:

On 5/27/06, John Jolet <[EMAIL PROTECTED]> wrote:
That does not work for ssh/scp sessions.  I usually test $PS1 to tell
> if it's really a shell -- the variable does not even exist for an
> scp session,
> although .bashrc gets called.
can you give us an example of what your .bashrc looks like?

Well, the whole thing is kinda long, but the part I was fooling with lately
now looks like this, and partly automates the use of ssh-agent for my
(very frequent) use of ssh from home to some machines at work.  The
problem was probably either the "echo" commands or that this actually
proceeds within a subshell.


if [ "x" != "x$PS1" ] ; then
    SHELL_LOGIN=1
else
    # Probably scp; empty string is false
    SHELL_LOGIN=
fi

if [ -n "$SHELL_LOGIN" ]
then
    if [ -z "$SSH_AGENT_PID" ]
    then
        # not yet running in ssh-agent
        ssh-agent /bin/bash
        r=$?
        echo Done with ssh-agent
        sleep 1
        exit $r
    else
        # this is an ssh-agent subshell
        echo You may want to run ssh-add.
    fi
fi

--
Kevin O'Gorman, PhD

well, you could comment out the "echo" commands and try it. personally, I try to stay away from things happening automatically for me. just my preference. I would rename .bashrc to something else, like old.bashrc and do the scp and see if that works. depending on what your needs are, you could also add a second user with the same uid, but a different home directory and use that other user for scp..... shrug. not a big fan of ssh_agent (or anything that caches credentials).
--
gentoo-user@gentoo.org mailing list

Reply via email to