1 |
On Mon, 13 Mar 2006, Hans-Werner Hilse wrote: |
2 |
|
3 |
> Hi, |
4 |
> |
5 |
> On Mon, 13 Mar 2006 20:14:33 +0000 (WET) |
6 |
> Jorge Almeida <jalmeida@××××××××××××.pt> wrote: |
7 |
> |
8 |
>> I want something like this: |
9 |
>> myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand $myvar |
10 |
>> [...] |
11 |
>> This does not work, because remotebox doesn't know about $myvar. Of |
12 |
>> course, if I could pass a variable to remotebox, the line might be just |
13 |
>> command="~/bin/mycommand" <public-key> |
14 |
>> and the ssh command would be |
15 |
>> myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand |
16 |
>> (the program itself would use the value of $myvar) |
17 |
> |
18 |
> Hm, I think you're making it unnecessary complex. What's wrong with |
19 |
> just piping it on stdin? I.e.: |
20 |
Indeed. The problem was me not understanding the relation of stdin with |
21 |
ssh when in non interactive mode... |
22 |
> |
23 |
> local$ echo "whatever" | ssh user@remote ./bin/mycommand |
24 |
> and in ./bin/mycommand: |
25 |
> --- |
26 |
> #!/bin/sh |
27 |
> read myvar |
28 |
> # do whatever |
29 |
> --- |
30 |
I tested and it works great. It seems I have a lot to learn although I |
31 |
use ssh daily with no problems. <SIGH> |
32 |
> |
33 |
> Or do you in fact use a pseudo tty on remote side for interactive mode |
34 |
> (which would make this a little more difficult)? |
35 |
> |
36 |
> If you want to keep your way of doing it, I just have a few hints, but |
37 |
> didn't test anything, just looked them up out of curiosity: |
38 |
> - read "man sshd_config", item AcceptEnv, PermitUserEnvironment |
39 |
I knew about PermitUserEnvironment and SendEnv, but somehow I missed |
40 |
AcceptEnv... Anyway, AcceptEnv seems to be global, wich is not what I |
41 |
want. |
42 |
> - read "man sshd", section LOGIN PROCESS |
43 |
You lost me here! I can't see relevancy---PermitUserEnvironment allows |
44 |
to use variables but not to set them from local. Anyway, stdin is the |
45 |
answer. |
46 |
|
47 |
Thank you. |
48 |
> |
49 |
> -hwh |
50 |
> |
51 |
|
52 |
-- |
53 |
Jorge Almeida |
54 |
-- |
55 |
gentoo-user@g.o mailing list |