#!/bin/bash

ROOT_DIR=/usr/local/etc
TEMP_FILE=/tmp/sshd_config.tmp

if [ "$1" = "" ] ; then 
  /bin/cat $ROOT_DIR/sshd_config  | /bin/sed -e 's/passwordauthentication no/passwordauthentication yes/g' > $TEMP_FILE.1
  /bin/cat $TEMP_FILE.1  | /bin/sed -e 's/usepam yes/usepam no/g' > $TEMP_FILE
else 
  /bin/cat $ROOT_DIR/sshd_config  | /bin/sed -e 's/passwordauthentication yes/passwordauthentication no/g' > $TEMP_FILE.1
  /bin/cat $TEMP_FILE.1  | /bin/sed -e 's/usepam no/usepam yes/g' > $TEMP_FILE
fi

if [ -f /tmp/sshd_config.tmp ] ; then 
  cp $TEMP_FILE $ROOT_DIR/sshd_config
fi

#/etc/init.d/sshd restart &

