source: src-qt4/pc-installgui/scripts/setup-ssh-keys.sh @ 93572be

9.2-releasereleng/10.0releng/10.0.1
Last change on this file since 93572be was 93572be, checked in by Kris Moore <kris@…>, 8 months ago

Welcome the new Life-Preserver restore ability to the Installer GUI

Now you can restore your entire system from a replicated life-preserver backup on a
remote machine

  • Property mode set to 100755
File size: 1.0 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}" ]; then
10  echo "ERROR: Usage setup-ssh-keys.sh <user> <host>"
11  touch /tmp/.ssh-auth-failed
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" ]; then
21mkdir .ssh >/dev/null 2>/dev/null
22  ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa
23  sync
24fi
25
26if [ ! -e ".ssh/id_rsa.pub" ]; then
27  echo "ERROR: Failed creating .ssh/id_rsa.pub"
28  touch /tmp/.ssh-auth-failed
29  exit 150
30fi
31
32# Get the .pub key
33PUBKEY="`cat .ssh/id_rsa.pub`"
34
35echo $PUBKEY | ssh -p $SSHPORT $SSHUSER@$SSHHOST 'mkdir .ssh ; chmod 700 .ssh ; tee -a .ssh/authorized_keys ; chmod 644 .ssh/authorized_keys'
36if [ $? -ne 0 ] ; then
37   touch /tmp/.ssh-auth-failed
38else
39   rm /tmp/.ssh-auth-failed >/dev/null 2>/dev/null
40fi
41exit 0
Note: See TracBrowser for help on using the repository browser.