#!/bin/sh
#
# $Header: provisionCopySSHKeys.sh 04-feb-2006.05:47:52 adeb Exp $
#
# provisionCopySSHKeys.sh
#
# Copyright (c) 2006, Oracle. All rights reserved.  
#
#    NAME
#      provisionCopySSHKeys.sh - <one-line expansion of the name>
#
#    DESCRIPTION
#    adds the user and public host keys from a mounted location to the SSH key files for the current user 	
#    NOTES
#	Argumetns:
#	Hostname
#	Mounted shared location 
#	Clone username
#    MODIFIED   (MM/DD/YY)
#    adeb        01/27/06 - Creation
#
usernm=$3
userhome=`awk -v usr="$usernm" -F: '$1 ==usr  {print $6}'  /etc/passwd`;
userKeyFile=$2/$1".identity";
hostKeyFile=$2/$1".hostkeys";
sudo -u $3 cat $userKeyFile >> $userhome/.ssh/authorized_keys;
sudo -u $3 cat $hostKeyFile  >> $userhome/.ssh/known_hosts;
