1#!/bin/bash 2 3########################################################################## 4# SecPanel.remoteconf - Client for Remote Account Manager 5# Shellscript for fetching and setting remote ssh access configuration 6# 7# Version SecPanel 0.6.0 8# Author: Steffen Leich <steffen.leich _at_ gmail.com> 9########################################################################## 10 11function do_exit { 12 echo 13 echo -e "Remote account management: transfer finished ($MODE)\n\nPress <Return> to continue" 14 read 15 exit 16} 17 18if [ -z $5 ] 19then 20cat <<EOF 21 22 SecPanel 23 Shellscript for fetching and setting remote ssh access configuration 24 Usage: secpanel_remoteconf.sh <host> <port> <user> <scpbin> <mode> <Runfile Timestamp> 25 26EOF 27 exit 2 28fi 29 30HOST=$1 31PORT=$2 32USER=$3 33SCPBIN=$4 34MODE=$5 35RFTS=$6 36 37cat <<EOF 38 39 SecPanel - Client for Remote Account Manager 40 ------------------------------------------------------ 41 42 Connecting to $HOST as $USER 43 44 45EOF 46 47 48RF="$HOME/.secpanel/.runfiles/ram.$RFTS" 49mkdir $RF 2> /dev/null 50 51if [ $MODE = "read" ] 52 then 53 54 $SCPBIN -P $PORT $USER@$HOST:.shosts $USER@$HOST:.ssh/authorized_keys $RF 55 chmod 600 $RF/authorized_keys $RF/.shosts 2>/dev/null 56 57elif [ $MODE = "write" ] 58 then 59 60 $SCPBIN -P $PORT $RF/.shosts $USER@$HOST: 61 $SCPBIN -P $PORT $RF/authorized_keys $USER@$HOST:.ssh 62 63else 64 echo "nothing to do..." 65fi 66 67do_exit 68