From owner-freebsd-questions@FreeBSD.ORG Mon Oct 15 18:32:02 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1311816A417 for ; Mon, 15 Oct 2007 18:32:02 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 6701313C4BB for ; Mon, 15 Oct 2007 18:32:00 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup211.ach.sch.gr [81.186.70.211]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id l9FIVBD8003763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 15 Oct 2007 21:31:34 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l9F9dRPC010745; Mon, 15 Oct 2007 12:39:51 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l9F9dM4Z010741; Mon, 15 Oct 2007 12:39:22 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 15 Oct 2007 12:39:22 +0300 From: Giorgos Keramidas To: Juri Mianovich Message-ID: <20071015093922.GA10681@kobe.laptop> References: <20071012143730.GC3881@kobe.laptop> <687623.75032.qm@web45604.mail.sp1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <687623.75032.qm@web45604.mail.sp1.yahoo.com> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.919, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.48, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: help with text-append over SSH ? - dd: unknown operand >> X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2007 18:32:02 -0000 On 2007-10-12 16:43, Juri Mianovich wrote: >--- Giorgos Keramidas wrote: >>On 2007-10-11 16:49, Juri Mianovich >> wrote: >>> >>> I have an account on a system where I cannot log in over SSH, but I >>> _can_ run a limited set of commands remotely, over SSH. (I am in a >>> jail of some sorts). >>> >>> I want to append the contents of a local text file to the contents >>> of a remote text file, over SSH. >>> >>> Normally, I would do this locally with: >>> >>> cat file1 >> file2 >>> >>> But again, file2 is remote, and I can't log in there... I have >>> access to the 'echo' command and the 'dd' command (among others) on >>> the remote host ... so for instance, I can do things like this: >>> >>> ssh user@host rm -rf filename >>> >>> So, with all that in mind, how do I append the contents of a local >>> file to a remote file, over SSH, using either 'echo' or 'dd' ? >> >> Try running: >> >> cat file1 | ssh user@host "dd >> file2" > > Thank you - I do indeed need to use 'dd' because I don't have access > to 'cat' in the chroot. > > However, when I use your example, I get this error: > > dd: unknown operand >> > > So I have something off a bit ... help ? Then you are not running a 'standard shell', but some sort of local hack and/or wrapper: kobe-> ssh server "echo 'hello world' > foo" kobe-> ssh server "od -c foo" 0000000 h e l l o w o r l d \n 0000014 kobe-> echo hello new world | ssh server "dd >> foo" 0+1 records in 0+1 records out kobe-> ssh server "od -c foo" 0000000 h e l l o w o r l d \n h e l l 0000020 o n e w w o r l d \n 0000034 kobe-> I'm sorry, but I don't think you can get effective "help" from the FreeBSD lists. You will have to ask for specific guidelines and help from your hosting provider. Anything else will be guesswork and may break without any sort of notice in the future, when your host decides to install a "new" "security fix" to their custom shell. - Giorgos