[Gllug] Passwordless SSH

ccooke ccooke-gllug at gkhs.net
Tue Sep 6 09:21:48 UTC 2005


On Mon, Sep 05, 2005 at 11:18:12PM +0100, James McGuigan wrote:
> Nix wrote:
> > On Fri, 26 Aug 2005, James McGuigan spake:
> > 
> >>cat ~/.ssh/id_dsa.pub | ssh remote.host.org tee -a ~/.ssh/authorized_keys
> > 
> > Congratulations! You are the Useless Use of Cat Award Winner for August 2005!
> 
> While you could turn it around:
> (ssh remote.host.org tee -a ~/.ssh/authorized_keys) < ~/.ssh/id_dsa.pub
> 
> It does make it a little more awkward to type.
> 
> Is there an easier way to append (rather than copy) to a file over a network than:
> cat | tee -a $file
> 

In this case, there certainly is:

ssh remote.host.org "echo $( cat ~/.ssh/id_dsa.pub ) >>
.ssh/authorized_keys"

(This is fine for single-line files like a public key. For multi-line
files, just embed quotes:

ssh remote.host.org "echo '$( cat ~/.ssh/id_dsa.pub )' >>
.ssh/authorized_keys"

Admittedly, this is just as *ugly*...

-- 
X=80;Y=24;((Z=X*Y));O=(X+1 X X-1 1);a(){ for((p=0;p<Z;p++));do((y=p/X+1,x=p%X+\
1));q=${B[p]};z=0;[ $i ]||B[$p]=$(($RANDOM%3));for e in ${O[@]} ${O[@]//#/-};d\
o(((j=p-e)>0))&&((0${B[j]}>0))&&((z++));done;c=\ ;(($z==3))&&c=1;(($z==2))&&c=\
$q;echo -ne "\E[$y;${x}H$c";A[p]=$c;done;((i++));B=( "${A[@]}" );a;};a # ccooke
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list