From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.54) id 1FIuwV-0006RE-5Y for garchives@archives.gentoo.org; Mon, 13 Mar 2006 21:51:07 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5.20060308/8.13.5) with SMTP id k2DLlOMp029625; Mon, 13 Mar 2006 21:47:24 GMT Received: from gabriel.sub.uni-goettingen.de (gabriel.sub.uni-goettingen.de [134.76.163.126]) by robin.gentoo.org (8.13.5.20060308/8.13.5) with ESMTP id k2DLZxlQ029896 for ; Mon, 13 Mar 2006 21:35:59 GMT Received: by gabriel.sub.uni-goettingen.de (Postfix, from userid 8) id E3814BF326; Mon, 13 Mar 2006 22:35:58 +0100 (CET) Received: from jack (dslc-082-082-188-208.pools.arcor-ip.net [82.82.188.208]) by gabriel.sub.uni-goettingen.de (Postfix) with ESMTP id 497FFBF320 for ; Mon, 13 Mar 2006 22:35:57 +0100 (CET) Date: Mon, 13 Mar 2006 21:36:01 +0100 From: Hans-Werner Hilse To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] [OT] Passing env variable to ssh? Message-Id: <20060313213601.5f4b5c5c.hilse@web.de> In-Reply-To: References: X-Mailer: Sylpheed version 2.2.0beta8 (GTK+ 2.8.12; i586-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Details: No, hits=1.6 required=5.0 tests=AWL,RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=no version=2.64 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on gabriel.sub.uni-goettingen.de X-Archives-Salt: 60b37a3c-fd4c-40e6-b671-544a4ab7f97a X-Archives-Hash: 095fde490198b0158d5479baef26de40 Hi, On Mon, 13 Mar 2006 20:14:33 +0000 (WET) Jorge Almeida 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" > 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