On 2006-03-13 20:14:33 +0000 (Mon, Mar), Jorge Almeida wrote:
> Anyone knows a way to pass an environment variable to a openssh command?
> I doubt there is a way, but who knows...
> I want something like this:
> myvar="whatever" ssh [EMAIL PROTECTED] ./bin/mycommand $myvar
> This would execute a command with argument "whatever". The problem is that I
> want to authenticate via a cryptographic key allowing only this command,
> i.e., the file ~/.ssh/authorized_keys of myuser at remotebox has a line
> command="~/bin/mycommand $myvar" <public-key>
> This does not work, because remotebox doesn't know about $myvar. Of
> course, if I could pass a variable to remotebox, the line might be just
> command="~/bin/mycommand" <public-key>
> and the ssh command would be
> myvar="whatever" ssh [EMAIL PROTECTED] ./bin/mycommand
> (the program itself would use the value of $myvar)
> 
> Any idea?

Stdin?

echo "$myvar" | ssh  [EMAIL PROTECTED] ./bin/mycommand

?

-- 
No virus found in this outgoing message.
Checked by "grep -i virus $MESSAGE"
Trust me.

Attachment: pgptlJO7V5PGW.pgp
Description: PGP signature

Reply via email to