Thread: Linux question
View Single Post
Old 07-20-2005, 04:21 AM  
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
Found this nice script for the purpose, i thought i would share

#/bin/sh
# RSA keys may be subject to export restrictions

if [ ! -n "$1" ]
then
echo "Usage: `basename $0` [email protected]"
exit
fi

if [ ! -e ~/.ssh/id_rsa.pub ]
then
echo "Generating RSA key"
ssh-keygen -t rsa
fi

echo "Copying local SSH pub_key to $1"
echo "Please enter password for remote account:"

# Use scp to opy key to remote temp file

scp ~/.ssh/id_rsa.pub $1:~/.ssh/authorized_keys.tmp

# Append key to ~/.ssh/authorized_keys

echo "Please enter password again to append key to remote 'authorized_keys' file"
ssh $1 "cat ~/.ssh/authorized_keys.tmp >> ~/.ssh/authorized_keys; rm ~/.ssh/authorized_keys.tmp; exit"
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote