1 |
On May 28, 2006, at 11:21 AM, Kevin O'Gorman wrote: |
2 |
|
3 |
> On 5/27/06, John Jolet <john@×××××.net> wrote: |
4 |
> That does not work for ssh/scp sessions. I usually test $PS1 to tell |
5 |
> > if it's really a shell -- the variable does not even exist for an |
6 |
> > scp session, |
7 |
> > although .bashrc gets called. |
8 |
> can you give us an example of what your .bashrc looks like? |
9 |
> |
10 |
> Well, the whole thing is kinda long, but the part I was fooling |
11 |
> with lately |
12 |
> now looks like this, and partly automates the use of ssh-agent for my |
13 |
> (very frequent) use of ssh from home to some machines at work. The |
14 |
> problem was probably either the "echo" commands or that this actually |
15 |
> proceeds within a subshell. |
16 |
> |
17 |
> |
18 |
> if [ "x" != "x$PS1" ] ; then |
19 |
> SHELL_LOGIN=1 |
20 |
> else |
21 |
> # Probably scp; empty string is false |
22 |
> SHELL_LOGIN= |
23 |
> fi |
24 |
> |
25 |
> if [ -n "$SHELL_LOGIN" ] |
26 |
> then |
27 |
> if [ -z "$SSH_AGENT_PID" ] |
28 |
> then |
29 |
> # not yet running in ssh-agent |
30 |
> ssh-agent /bin/bash |
31 |
> r=$? |
32 |
> echo Done with ssh-agent |
33 |
> sleep 1 |
34 |
> exit $r |
35 |
> else |
36 |
> # this is an ssh-agent subshell |
37 |
> echo You may want to run ssh-add. |
38 |
> fi |
39 |
> fi |
40 |
> |
41 |
> -- |
42 |
> Kevin O'Gorman, PhD |
43 |
|
44 |
well, you could comment out the "echo" commands and try it. |
45 |
personally, I try to stay away from things happening automatically |
46 |
for me. just my preference. I would rename .bashrc to something |
47 |
else, like old.bashrc and do the scp and see if that works. |
48 |
depending on what your needs are, you could also add a second user |
49 |
with the same uid, but a different home directory and use that other |
50 |
user for scp..... shrug. not a big fan of ssh_agent (or anything |
51 |
that caches credentials). |
52 |
-- |
53 |
gentoo-user@g.o mailing list |