source: src-qt4/life-preserver/lp-gui/scripts/setup-ssh-keys.sh @ 6a2483b

9.2-releasereleng/10.0releng/10.0.1
Last change on this file since 6a2483b was 6a2483b, checked in by Ken Moore <ken@…>, 6 months ago

Remove the old life-preserver from the src-qt4/life-preserver dir, and replace it with src-qt4/life-preserver/lp-tray and src-qt4/life-preserver/lp-gui.

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/sh
2# Script for Life-Preserver which sets up password-less logins for ssh host
3###########################################################################
4
5SSHUSER=$1
6SSHHOST=$2
7SSHPORT=$3
8
9if [ -z "${SSHUSER}" -o -z "${SSHHOST}" ]
10then
11echo "ERROR: Usage setup-ssh-keys.sh <user> <host>"
12  exit 150
13fi
14
15cd /root
16
17echo "Preparing to setup SSH key authorization..."
18echo "When prompted, enter your password for ${SSHUSER}@${SSHHOST}"
19
20if [ ! -e ".ssh/id_rsa.pub" ]
21then
22mkdir .ssh >/dev/null 2>/dev/null
23  ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa
24  sleep 1
25fi
26
27if [ ! -e ".ssh/id_rsa.pub" ]
28then
29echo "ERROR: Failed creating .ssh/id_rsa.pub"
30  read tmp
31  exit 150
32fi
33
34# Get the .pub key
35PUBKEY="`cat .ssh/id_rsa.pub`"
36
37echo $PUBKEY | ssh -p $SSHPORT $SSHUSER@$SSHHOST 'mkdir .ssh ; chmod 700 .ssh ; tee -a .ssh/authorized_keys ; chmod 644 .ssh/authorized_keys'
38
39echo $PUBKEY | ssh -p $SSHPORT $SSHUSER@$SSHHOST 'mkdir .ssh ; chmod 700 .ssh ; tee -a .ssh/authorized_keys2 ; chmod 644 .ssh/authorized_keys2'
40
41if [ "$?" != "0" ]; then
42  touch /tmp/.failedPreserver-${SSHUSER}
43fi
44
45echo "Press ENTER to continue"
46read tmp
Note: See TracBrowser for help on using the repository browser.