Re: Piping and scripts with scp

From: Alson van der Meulen (freebsd@alson.linuxfreak.nl)
Date: 07/18/01


Date: Wed, 18 Jul 2001 22:04:42 +0200
From: Alson van der Meulen <freebsd@alson.linuxfreak.nl>
To: security@freebsd.org

On Wed, Jul 18, 2001 at 01:59:54PM -0600, Brett Glass wrote:
> I need to create a script that deposits the output of a program in a file on a
> remote host. I'd like to do this over an encrypted connection, so I'd like to
> use scp for this purpose. The script will need to execute via cron and run
> unattended, and I'm limited to the SSH-1 protocol for the moment (though I
> intend to move to SSH-2 when all the hosts can handle it).
>
> Trouble is, I cannot seem to find options for scp that will allow me
> to (a) pipe data into it for placement in the remote file; or
echo foo | ssh myuser@myhost dd of=bar

> (b) supply a password -- kept only in the script, which cannot be
> read except by root -- in advance rather than manually at the console.
> (Yes, I could generate and use RSA keys, but since anyone who could
> view the script will have broken root, he or she could also get at
> the private key anyway... so there's no additional security in this.)
> Help from someone experienced with scp and ssh would be appreciated.
You really should use RSA keys without passphrase for this, though you
could use something like expect to enter a password in batch, RSA keys
is really the way to go for scripts.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message



Relevant Pages

  • Piping and scripts with scp
    ... remote host. ... The script will need to execute via cron and run ... I cannot seem to find options for scp that will allow me ... (Yes, I could generate and use RSA keys, but since anyone who could ...
    (FreeBSD-Security)
  • Re: Redirecting stdin to a file requiring parameters
    ... scp your script and run it with parameters on the remote host ... sed your script to receive your parameters into a new file on the ... When I say "sed your script", I mean putting some sort of unique string ...
    (comp.unix.shell)
  • Re: yet another question on file names with spaces?
    ... > What's echo for? ... know what they are before the script runs - see below. ... present locally, but not remotely, I copy to the remote machine via scp. ... images and pdfs which I only want to transfer once. ...
    (comp.unix.shell)
  • Re: scp and scripts?
    ... The following is basically what I want the script to do, ... >> but I heard scp will not work with authentication. ... > an SSH key of the appropriate type. ... > want a passphrase; press enter to use a blank passphrase. ...
    (Debian-User)
  • RE: Script doesnt complete via Cron
    ... Assuming you are using rsa or dsa public key authentication for the ... Setting it up under root's crontab won't work - the ... I have an user account called "copy" created for scp transfers. ... Script doesn't complete via Cron ...
    (freebsd-questions)

Loading