Gentoo Archives: gentoo-user

From: Hans-Werner Hilse <hilse@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Passing env variable to ssh?
Date: Mon, 13 Mar 2006 21:51:07
Message-Id: 20060313213601.5f4b5c5c.hilse@web.de
In Reply to: [gentoo-user] [OT] Passing env variable to ssh? by Jorge Almeida
1 Hi,
2
3 On Mon, 13 Mar 2006 20:14:33 +0000 (WET)
4 Jorge Almeida <jalmeida@××××××××××××.pt> wrote:
5
6 > I want something like this:
7 > myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand $myvar
8 > [...]
9 > This does not work, because remotebox doesn't know about $myvar. Of
10 > course, if I could pass a variable to remotebox, the line might be just
11 > command="~/bin/mycommand" <public-key>
12 > and the ssh command would be
13 > myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand
14 > (the program itself would use the value of $myvar)
15
16 Hm, I think you're making it unnecessary complex. What's wrong with
17 just piping it on stdin? I.e.:
18
19 local$ echo "whatever" | ssh user@remote ./bin/mycommand
20 and in ./bin/mycommand:
21 ---
22 #!/bin/sh
23 read myvar
24 # do whatever
25 ---
26
27 Or do you in fact use a pseudo tty on remote side for interactive mode
28 (which would make this a little more difficult)?
29
30 If you want to keep your way of doing it, I just have a few hints, but
31 didn't test anything, just looked them up out of curiosity:
32 - read "man sshd_config", item AcceptEnv, PermitUserEnvironment
33 - read "man sshd", section LOGIN PROCESS
34
35 -hwh
36 --
37 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [OT] Passing env variable to ssh? Jorge Almeida <jalmeida@××××××××××××.pt>