1 |
On 2006-03-13 20:14:33 +0000 (Mon, Mar), Jorge Almeida wrote: |
2 |
> Anyone knows a way to pass an environment variable to a openssh command? |
3 |
> I doubt there is a way, but who knows... |
4 |
> I want something like this: |
5 |
> myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand $myvar |
6 |
> This would execute a command with argument "whatever". The problem is that I |
7 |
> want to authenticate via a cryptographic key allowing only this command, |
8 |
> i.e., the file ~/.ssh/authorized_keys of myuser at remotebox has a line |
9 |
> command="~/bin/mycommand $myvar" <public-key> |
10 |
> This does not work, because remotebox doesn't know about $myvar. Of |
11 |
> course, if I could pass a variable to remotebox, the line might be just |
12 |
> command="~/bin/mycommand" <public-key> |
13 |
> and the ssh command would be |
14 |
> myvar="whatever" ssh myuser@×××××××××.org ./bin/mycommand |
15 |
> (the program itself would use the value of $myvar) |
16 |
> |
17 |
> Any idea? |
18 |
|
19 |
Stdin? |
20 |
|
21 |
echo "$myvar" | ssh myuser@×××××××××.org ./bin/mycommand |
22 |
|
23 |
? |
24 |
|
25 |
-- |
26 |
No virus found in this outgoing message. |
27 |
Checked by "grep -i virus $MESSAGE" |
28 |
Trust me. |