#!/bin/bash # # Copyright 2006, CRIM, Revolution Linux Inc. # # $Id: 20_sendsshkeys.sh 1513 2006-03-24 05:57:48Z jmdault $ # # Authors : Gabriel Lefebvre <Email> # # This file is part of the MILLE-XTERM project. # # http://www.revolutionlinux.com/mille-xterm/ # http://www.mille.ca/ # # This program is covered by the GNU General Public License. # See the COPYING file in the top-level MILLE-XTERM directory. # # ------------------------------------------------------------------------- # # Pre session script used in MILLE-XTERM project # To be copied in the /etc/X11/gdm/PreSession directory # # This script should be called by /etc/X11/gdm/PreSession/Default with the following line : # /etc/X11/gdm/PreSession/sendsshkeys.sh & # MYUSER=$USER MYHOME=$HOME #Test #MYUSER=demo;MYHOME=/home/demo WRKDIR=$MYHOME/.localapps SETUPSSHKEYS=/usr/sbin/setupsshkeys.sh # # Generate user's ssh-keys in $WRKDIR # if [ ! -d "${WRKDIR}" ]; then su -c "mkdir -p ${WRKDIR}" $MYUSER su -c "chmod 0700 ${WRKDIR}" $MYUSER fi rm -f /tmp/$MYUSER-key* c1="if [ ! -f ${WRKDIR}/$MYUSER-key ]" c2="then ssh-keygen -q -t dsa -f ${WRKDIR}/$MYUSER-key -C 'xtermkey' -N ''" c3="mkdir -p $MYHOME/.ssh" c4="cat ${WRKDIR}/$MYUSER-key.pub > $MYHOME/.ssh/authorized_keys2" c5="chmod 600 $MYHOME/.ssh/*;chmod 700 $MYHOME/.ssh;fi" c6="cp -a ${WRKDIR}/$MYUSER-key* /tmp;chmod 600 /tmp/$MYUSER-key*" cmd="$c1;$c2;$c3;$c4;$c5;$c6" (echo 10; su -c "$cmd" $USER; echo "100") \ | zenity --progress --pulsate --auto-close \ --progress-text "Configuring security (SSH-keys)... This can take a few minutes..." \ --title "Please Wait..." --width 320