[plug] local file referencing in remote ssh commands

Bernard Blackham bernard at blackham.com.au
Fri Apr 4 11:41:02 WST 2003


On Fri, Apr 04, 2003 at 10:48:33AM +0800, Ryan wrote:
> As I was typing the sentence about the local SSH call getting run first
> I figured out what was going on - and therefore the answer to my query
> is:
> 
> ssh {REMOTE_HOST} "echo `cat ~/.ssh/id_dsa.pub` >>
> ~/.ssh/authorized_keys"

Unrelated, but have a peek at ssh-copy-id - it does more or less
this (but it could be greatly improved still, error checking-wise).

> Having discovered that - is there a more correct or established way to
> reference local files in remote calls than this?

You could use stdin/out as such:

cat ~/.ssh/id_dsa.pub | ssh {REMOTE_HOST} "cat >> ~/.ssh/authorized_keys"

HTH,

Bernard.

-- 
 Bernard Blackham 
 bernard at blackham dot com dot au



More information about the plug mailing list