Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Multiple scp targets?

On Wed, Nov 10, 2010 at 19:28, Stephen J. Turnbull <> wrote:
> How about
> #! /bin/sh
> seconds=30            # TTL for ssh-agent; season to taste
> host=$1; shift
> echo "Sending $@ to host $host..."
> ssh-add -t $seconds ~/.ssh/$host
> # if <target> or <pathN> need to vary by host, use "case $host in ..."
> # if <pathN> needs to be specified on the command line, you'll need
> # more trickery
> for path in path1 path2; do scp $@ ${host}:/target/$path; done
> # end script

Add "ssh-add -d ...keyfile..." at the end of the script (or in a trap)
to make sure the key gets deleted.

"man ssh-add"
"man bash" / "man trap"


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links