#!/bin/bash
#===============================================================================
#
# FILE: setup_ssh.sh
#
# USAGE: ./setup_ssh.sh server-address
#
# DESCRIPTION: Sets up password-less ssh login to another machine
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: John Ryland (jryland@xiaofrog.com)
# COMPANY: InvertedLogic
# VERSION: 1.0
# CREATED: 31/07/2008 22:53:01 JST
# REVISION: ---
#===============================================================================
if [ "$1" == "" ]
then
echo "Usage $0 server-address"
exit 0
fi
if [ ! -f ~/.ssh/id_rsa.pub ]
then
echo | ssh-keygen -t rsa
fi
scp ~/.ssh/id_rsa.pub $1:tmp.pub
ssh $1 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; cat tmp.pub >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys ; rm tmp.pub'