Gentoo Archives: gentoo-user

From: Jorge Almeida <jalmeida@××××××××××××.pt>
To: gentoo-user@l.g.o
Subject: [gentoo-user] [OT] Passing env variable to ssh?
Date: Mon, 13 Mar 2006 20:32:53
Message-Id: Pine.LNX.4.64.0603131957520.29486@jmaa.math.ist.utl.pt
1 Anyone knows a way to pass an environment variable to a openssh command?
2 I doubt there is a way, but who knows...
3 I want something like this:
4 myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand $myvar
5 This would execute a command with argument "whatever". The problem is that I
6 want to authenticate via a cryptographic key allowing only this command,
7 i.e., the file ~/.ssh/authorized_keys of myuser at remotebox has a line
8 command="~/bin/mycommand $myvar" <public-key>
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 Any idea?
17
18 --
19 Jorge Almeida
20 --
21 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [OT] Passing env variable to ssh? "Mariusz Pękala" <skoot@××.pl>
Re: [gentoo-user] [OT] Passing env variable to ssh? Hans-Werner Hilse <hilse@×××.de>