From: Hans-Werner Hilse <hilse@web.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] [OT] Passing env variable to ssh?
Date: Mon, 13 Mar 2006 21:36:01 +0100 [thread overview]
Message-ID: <20060313213601.5f4b5c5c.hilse@web.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0603131957520.29486@jmaa.math.ist.utl.pt>
Hi,
On Mon, 13 Mar 2006 20:14:33 +0000 (WET)
Jorge Almeida <jalmeida@math.ist.utl.pt> wrote:
> I want something like this:
> myvar="whatever" ssh myuser@remotebox.org ./bin/mycommand $myvar
> [...]
> 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 myuser@remotebox.org ./bin/mycommand
> (the program itself would use the value of $myvar)
Hm, I think you're making it unnecessary complex. What's wrong with
just piping it on stdin? I.e.:
local$ echo "whatever" | ssh user@remote ./bin/mycommand
and in ./bin/mycommand:
---
#!/bin/sh
read myvar
# do whatever
---
Or do you in fact use a pseudo tty on remote side for interactive mode
(which would make this a little more difficult)?
If you want to keep your way of doing it, I just have a few hints, but
didn't test anything, just looked them up out of curiosity:
- read "man sshd_config", item AcceptEnv, PermitUserEnvironment
- read "man sshd", section LOGIN PROCESS
-hwh
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2006-03-13 21:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-13 20:14 [gentoo-user] [OT] Passing env variable to ssh? Jorge Almeida
2006-03-13 20:36 ` Hans-Werner Hilse [this message]
2006-03-13 22:42 ` Jorge Almeida
2006-03-13 21:16 ` Mariusz Pękala
2006-03-13 22:44 ` Jorge Almeida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060313213601.5f4b5c5c.hilse@web.de \
--to=hilse@web.de \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox